We use Team Foundation Server 2015 with git. Our pull requests are normally linked to work items. How can I create a list of pull requests that lack linked work items? I tried to create a query in TFS, but to query on a pull request seems to be impossible.
To could use this REST API to get all pull request under your repository.
GET http://serverName:8080/tfs/MyCollection/_apis/git/repositories/9f504fb5-7168-49cb-9846-963fdfc3f2b1/pullRequests?api-version=3.0-preview
Then loop those pull request you get, use this REST API to get workitems linked to a pull request. The above REST API will return the pull request id of each pull request.
GET http://v-tinmo-12r2:8080/tfs/MyCollection/_apis/git/repositories/9f504fb5-7168-49cb-9846-963fdfc3f2b1/pullRequests/15/workitems?resource=pullRequestWorkItems