TFS 2017 | TFS 2015 | TFS 2013
Note
Looking for REST APIS that support TFS 2018 or later versions? See the Azure DevOps REST API Reference.
api-version = 1.0
If you haven't already, look at the information on getting started with these APIs.
Get a list of build definitions
GET https://{instance}/DefaultCollection/{project}/_apis/build/definitions?api-version={version}[&projectName={string}]
| Parameter | Type | Notes |
|---|---|---|
| URL | ||
| instance | string | TFS server name ({server:port}). |
| project | string | Project ID or name. |
| Query | ||
| api-version | string | Version of the API to use. |
| projectName | string | Name of the project that contains the build definitions. Wildcards (*) are supported. |
Sample request
GET https://mytfsserver/DefaultCollection/Fabrikam-Fiber-Git/_apis/build/definitions?api-version=1.0
Sample response
{
"value": [
{
"batchSize": 1,
"uri": "vstfs:///Build/Definition/2",
"queue": {
"queueType": "buildController",
"id": 274,
"name": "Hosted Build Controller",
"url": "https://mytfsserver/DefaultCollection/_apis/build/Queues/274"
},
"triggerType": "continuousIntegration",
"defaultDropLocation": "#/",
"buildArgs": "",
"dateCreated": "2014-03-13T16:29:21Z",
"supportedReasons": 63,
"lastBuild": {
"id": 348,
"url": "https://mytfsserver/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/build/Builds/348"
},
"definitionType": "xaml",
"id": 2,
"name": "MyWebSite CI",
"url": "https://mytfsserver/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/build/Definitions/2"
},
{
"batchSize": 1,
"uri": "vstfs:///Build/Definition/3",
"queue": {
"queueType": "buildController",
"id": 274,
"name": "Hosted Build Controller",
"url": "https://mytfsserver/DefaultCollection/_apis/build/Queues/274"
},
"triggerType": "continuousIntegration",
"defaultDropLocation": "#/",
"buildArgs": "",
"dateCreated": "2014-03-27T19:41:43.323Z",
"supportedReasons": 63,
"lastBuild": {
"id": 335,
"url": "https://mytfsserver/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/build/Builds/335"
},
"definitionType": "xaml",
"id": 3,
"name": "CustomerAddressModule",
"url": "https://mytfsserver/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/build/Definitions/3"
}
],
"count": 2
}
Get a build definition
GET https://{instance}/DefaultCollection/{project}/_apis/build/definitions/{definitionId}?api-version={version}
| Parameter | Type | Notes |
|---|---|---|
| URL | ||
| instance | string | TFS server name ({server:port}). |
| project | string | Project ID or name. |
| definitionId | int | ID of the build definition. |
| Query | ||
| api-version | string | Version of the API to use. |
Sample request
GET https://mytfsserver/DefaultCollection/Fabrikam-Fiber-Git/_apis/build/definitions/3?api-version=1.0
Sample response
{
"batchSize": 1,
"uri": "vstfs:///Build/Definition/3",
"queue": {
"queueType": "buildController",
"id": 274,
"name": "Hosted Build Controller",
"url": "https://mytfsserver/DefaultCollection/_apis/build/Queues/274"
},
"triggerType": "continuousIntegration",
"defaultDropLocation": "#/",
"buildArgs": "",
"dateCreated": "2014-03-27T19:41:43.323Z",
"supportedReasons": 63,
"lastBuild": {
"id": 335,
"url": "https://mytfsserver/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/build/Builds/335"
},
"definitionType": "xaml",
"id": 3,
"name": "CustomerAddressModule",
"url": "https://mytfsserver/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/build/Definitions/3"
}