问题
TFS 2015.3, on premises.
The REST API of TFS has an undocumented portion that deals with app pools: _apis/distributedtask/pools
on the server level and further down. I can drill down all the way to agent details: _apis/distributedtask/pools/111/agents/222
. Now, in the Web UI there are two collections per agent: requests and capabilities. Does anyone know the REST API URLs for those? Adding either /requests
or /capabilities
yields a "Document not found" error.
If the TFS API is somehow self describing, I have yet to discover how. I miss WSDL...
回答1:
I opened up Chrome Network inspector and found that these are the API calls for Requests and Capabilities. These are from latest VSTS but I think the same will work for TFS 2015.3 also.
For Requests:
_apis/distributedtask/pools/1/jobrequests?agentId=1&completedRequestCount=25
For Capabilities:
_apis/distributedtask/pools/1/agents/1?includeCapabilities=true
Note: These are undocumented so you should be vigilant while upgrading your TFS if you are taking dependencies on these.
来源:https://stackoverflow.com/questions/40050966/retrieving-a-list-of-agent-requests-from-tfs-rest-api