Hey all I'm new to the TFS api world so help would be great!
I am looking to gather information on my projects from the tfs version 15.112.26307.0 (2017) server.
My TFS web URL that lists ALL my projects is : http://tfsserv001:8080/tfs/prog/_projects
My TFS test app is this: http://tfsserv001:8080/tfs/prog/---2017
I am looking to get the build status from the Build & Release > Builds tab via API:
And after its succeeded I would then like it to create a release:
Are both above possible by using the TFS api?
There is related Rest API to get build result- include the status info
"result": "succeeded",
You could also use Rest API to create(trigger) a release based on some info such as build ID.
For more details you could take a look at this blog shows how to use rest api in powershell:
Moreover, Daniel is right. You could check the Continuous deployment ( create release and deploy whenever a build completes ) when you create a new release definition or select in triggers of the release definition. TFS server will handle this automatically, without the need of user intervention.
Update
A example when you open a build result in the web portal just as:
In the entire url there will include a buildID such as buildID=49
. So according to above screenshot, you should use
Get http://xxx:8080/tfs/DefaultCollection/ScrumMttApple/_apis/build/builds/49/?api-version=2.0
Then will get below JSON result:
"id": 49,
"buildNumber": "20170525.5",
"status": "completed",
"result": "succeeded",
"queueTime": "2017-05-25T19:17:39.6545026Z",
"startTime": "2017-05-25T19:17:42.2482602Z",
"finishTime": "2017-05-25T19:25:15.6808731Z",
"url": "http://win-kev0061habi:8080/tfs/DefaultCollection/bdd4809b-e6dd-4cb8-8e60-762373b20cdc/_apis/build/Builds/49",
"definition": {
"path": "\\",
"type": "build",
"revision": 5,
"id": 14,
"name": "OrdertTest",
.....
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.