« Azure devops api » : différence entre les versions
De Banane Atomic
Aller à la navigationAller à la recherche
(→List) |
|||
(21 versions intermédiaires par le même utilisateur non affichées) | |||
Ligne 13 : | Ligne 13 : | ||
"id": "111" | "id": "111" | ||
} | } | ||
</kode> | |||
== [https://docs.microsoft.com/en-us/rest/api/azure/devops/build/builds/get%20changes%20between%20builds?view=azure-devops-rest-6.0 Get Changes Between Builds] == | |||
<pre>GET https://dev.azure.com/{organization}/{project}/_apis/build/changes?api-version=6.0-preview.2</pre> | |||
<kode lang='json' collapsed> | |||
{ | |||
"count": 1, | |||
"value": [ | |||
{ | |||
"id": "1267ccdc5f768d9e158fa49c1de7e4363850b946", | |||
"message": "Merged PR 12345: PR title", | |||
"type": "TfsGit", | |||
"author": { | |||
"uniqueName": "email address" | |||
} | |||
} | |||
] | |||
} | |||
</kode> | </kode> | ||
= Work Item = | = Work Item = | ||
== [https://docs.microsoft.com/en-us/rest/api/azure/devops/wit/work%20items/get%20work%20item Get Work Item] == | == [https://docs.microsoft.com/en-us/rest/api/azure/devops/wit/work%20items/get%20work%20item Get Work Item] == | ||
<pre>GET https://dev.azure.com/{organization}/{project}/_apis/wit/workitems/{id}?api-version=6.0</pre> | <pre>GET https://dev.azure.com/{organization}/{project}/_apis/wit/workitems/{id}?$expand=relations&api-version=6.0</pre> | ||
<kode lang='json' collapsed> | |||
{ | |||
"id": 111, | |||
"fields": { | |||
"System.AreaPath": "My Projetc\\My Team", | |||
"System.TeamProject": "My Projetc", | |||
"System.IterationPath": "My Projetc\\Sprint 111", | |||
"System.WorkItemType": "Product Backlog Item", | |||
"System.State": "Done", | |||
"System.Reason": "Moved out of state 05_Ready for review", | |||
"System.AssignedTo": { | |||
"displayName": "Firstname Lastname", | |||
"id": "13245678-1234-134-1234-123465789012", | |||
"uniqueName": "firstname.lastname@domain.net" | |||
}, | |||
"System.Title": "My title", | |||
}, | |||
"relations": [ | |||
{ | |||
"rel": "ArtifactLink", | |||
"url": "vstfs:///Git/PullRequestId/{organization}%2F{project}%2F{PRid}", | |||
"attributes": { | |||
"id": 12345678, | |||
"name": "Pull Request" | |||
} | |||
} | |||
] | |||
} | |||
</kode> | |||
= Pipeline = | = Pipeline = | ||
Ligne 75 : | Ligne 122 : | ||
<kode lang='json' collapsed> | <kode lang='json' collapsed> | ||
{ | { | ||
"count": | "count": 1, | ||
"value": [ | "value": [ | ||
{ | { | ||
Ligne 86 : | Ligne 133 : | ||
} | } | ||
} | } | ||
</kode> | |||
== [https://docs.microsoft.com/en-us/rest/api/azure/devops/work/iterations/get%20iteration%20work%20items?view=azure-devops-rest-6.0 Get Iteration Work Items] == | |||
<pre>GET https://dev.azure.com/{organization}/{project}/{team}/_apis/work/teamsettings/iterations/{iterationId}/workitems?api-version=6.0-preview.1</pre> | |||
<kode lang='json' collapsed> | |||
{ | |||
"workItemRelations": [ | |||
{ | |||
"rel": null, | |||
"source": null, | |||
"target": { | |||
"id": 111, | |||
"url": "https://dev.azure.com/msc-dev/_apis/wit/workItems/111" | |||
} | |||
} | |||
</kode> | |||
= Task agent = | |||
== [https://docs.microsoft.com/en-us/rest/api/azure/devops/distributedtask/environmentdeployment%20records/list?view=azure-devops-rest-6.0 Environmentdeployment Records - List] == | |||
<pre>GET https://dev.azure.com/{organization}/{project}/_apis/distributedtask/environments/{environmentId}/environmentdeploymentrecords?api-version=6.0-preview.1</pre> | |||
<kode lang='json' collapsed> | |||
{ | |||
"count": 1, | |||
"value": [ | |||
{ | |||
"id": 111, | |||
"planType": "Build", | |||
"stageName": "DEMO", | |||
"jobName": "DeployPresentation", | |||
"stageAttempt": 1, | |||
"jobAttempt": 1, | |||
"definition": { | |||
"id": 111, // pipeline id | |||
"name": "My pipeline" | |||
}, | |||
"owner": { | |||
"id": 111, // build id | |||
"name": "20210128.4" | |||
}, | |||
"result": "succeeded", | |||
"queueTime": "2021-01-28T15:10:54.8233333Z", | |||
"startTime": "2021-01-28T15:10:54.9466667Z", | |||
"finishTime": "2021-01-28T15:14:05.21Z" | |||
} | |||
</kode> | |||
= Git = | |||
== Pull request == | |||
=== [https://docs.microsoft.com/en-us/rest/api/azure/devops/git/pull%20requests/get%20pull%20requests Get] === | |||
<pre>GET https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repository}/pullrequests?api-version=6.0</pre> | |||
{| class="wikitable wtp wtmono1 wtmono2" | |||
|+ Query parameters | |||
! name | |||
! value | |||
|- | |||
| searchCriteria.creatorId || creatorId | |||
|- | |||
| searchCriteria.status || active, completed, abandoned, notSet, all<br>(active by default) | |||
|- | |||
| $top || \d+ | |||
|} | |||
<kode lang='json' collapsed> | |||
{ | |||
"count": 1, | |||
"value": [ | |||
{ | |||
"pullRequestId": 66034, | |||
"status": "active", | |||
"createdBy": { | |||
"displayName": "Firstname Lastname", | |||
"id": "12345678-1234-1234-1234-123456789012", | |||
"uniqueName": "firstname.lastname@organization.net" | |||
}, | |||
"creationDate": "2020-12-16T17:41:23.5291166Z", | |||
"title": "PR title", | |||
"description": "description", | |||
"sourceRefName": "refs/heads/bugfix/sonar/branch-name", | |||
"targetRefName": "refs/heads/master", | |||
"mergeStatus": "succeeded", | |||
"isDraft": false, | |||
"mergeId": "12345678-1234-1234-1234-123456789012" | |||
} | |||
] | |||
} | |||
</kode> | |||
=== [https://docs.microsoft.com/en-us/rest/api/azure/devops/git/pull%20requests/get%20pull%20request%20by%20id?view=azure-devops-rest-6.0 Get Pull Request By Id] === | |||
<pre>GET https://dev.azure.com/{organization}/{project}/_apis/git/pullrequests/{pullRequestId}?api-version=6.0</pre> | |||
<kode lang='json' collapsed> | |||
{ | |||
"pullRequestId": 12345, | |||
"status": "completed", | |||
"title": "PR title", | |||
"targetRefName": "refs/heads/master", | |||
"mergeStatus": "succeeded", | |||
"isDraft": false, | |||
} | |||
</kode> | |||
=== [https://docs.microsoft.com/en-us/rest/api/azure/devops/git/pull%20request%20work%20items/list Work Items - List] === | |||
<pre>GET https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repository}/pullrequests/{pullRequestId}/workitems?api-version=6.0</pre> | |||
<kode lang='json' collapsed> | |||
{ | |||
"count": 1, | |||
"value": [ | |||
{ | |||
"id": "123456", | |||
"url": "https://dev.azure.com/{organization}/_apis/wit/workItems/123456" | |||
} | |||
] | |||
} | |||
</kode> | |||
=== [https://docs.microsoft.com/en-us/rest/api/azure/devops/git/pull%20request%20commits/get%20pull%20request%20commits?view=azure-devops-rest-6.0 Get Pull Request Commits] === | |||
<pre>GET https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/pullRequests/{pullRequestId}/commits?api-version=6.0</pre> | |||
<kode lang='json' collapsed> | |||
{ | |||
"count": 1, | |||
"value": [ | |||
{ | |||
"commitId": "384d5606d55ff94bc798bca274098bf3d0022fbb", | |||
"comment": "commit message" | |||
} | |||
} | |||
</kode> | </kode> |
Dernière version du 29 mars 2021 à 13:13
Links
Build
Get Build Work Items Refs
GET https://dev.azure.com/{organization}/{project}/_apis/build/builds/{buildId}/workitems?api-version=6.0
{ "count": 1, "value": [ { "id": "111" } |
Get Changes Between Builds
GET https://dev.azure.com/{organization}/{project}/_apis/build/changes?api-version=6.0-preview.2
{ "count": 1, "value": [ { "id": "1267ccdc5f768d9e158fa49c1de7e4363850b946", "message": "Merged PR 12345: PR title", "type": "TfsGit", "author": { "uniqueName": "email address" } } ] } |
Work Item
Get Work Item
GET https://dev.azure.com/{organization}/{project}/_apis/wit/workitems/{id}?$expand=relations&api-version=6.0
{ "id": 111, "fields": { "System.AreaPath": "My Projetc\\My Team", "System.TeamProject": "My Projetc", "System.IterationPath": "My Projetc\\Sprint 111", "System.WorkItemType": "Product Backlog Item", "System.State": "Done", "System.Reason": "Moved out of state 05_Ready for review", "System.AssignedTo": { "displayName": "Firstname Lastname", "id": "13245678-1234-134-1234-123465789012", "uniqueName": "firstname.lastname@domain.net" }, "System.Title": "My title", }, "relations": [ { "rel": "ArtifactLink", "url": "vstfs:///Git/PullRequestId/{organization}%2F{project}%2F{PRid}", "attributes": { "id": 12345678, "name": "Pull Request" } } ] } |
Pipeline
List
GET https://dev.azure.com/{organization}/{project}/_apis/pipelines?api-version=6.0-preview.1
{ "count": 1, "value": [ { "id": 111, "revision": 1, "name": "MyPipeline", "folder": "\\MyFolder" } |
Runs - List
GET https://dev.azure.com/{organization}/{project}/_apis/pipelines/{pipelineId}/runs?api-version=6.0-preview.1
{ "count": 1, "value": [ { "pipeline": { "id": 111, "name": "MyPipeline" }, "state": "completed", "result": "failed", "createdDate": "2021-01-27T08:26:17.5864636Z", "finishedDate": "2021-01-27T09:07:43.4227015Z", "id": 222, "name": "20210127.3" } |
Team
List
GET https://dev.azure.com/{organization}/_apis/projects/{project}/teams?api-version=6.0
{ "count": 1, "value": [ { "id": "12345678-1234-1234-1234-123456789012", "name": "My Team", "description": "Team description", "projectName": "My Project", "projectId": "12345678-1234-1234-1234-123456789012" } |
Iteration / Sprint
List
GET https://dev.azure.com/{organization}/{project}/{team}/_apis/work/teamsettings/iterations?api-version=6.0
{ "count": 1, "value": [ { "id": "12345678-1234-1234-1234-123456789012", "name": "Sprint 111", "attributes": { "startDate": "2021-04-01T00:00:00Z", "finishDate": "2021-04-12T00:00:00Z", "timeFrame": "current" /* past, future */ } } |
Get Iteration Work Items
GET https://dev.azure.com/{organization}/{project}/{team}/_apis/work/teamsettings/iterations/{iterationId}/workitems?api-version=6.0-preview.1
{ "workItemRelations": [ { "rel": null, "source": null, "target": { "id": 111, "url": "https://dev.azure.com/msc-dev/_apis/wit/workItems/111" } } |
Task agent
Environmentdeployment Records - List
GET https://dev.azure.com/{organization}/{project}/_apis/distributedtask/environments/{environmentId}/environmentdeploymentrecords?api-version=6.0-preview.1
{ "count": 1, "value": [ { "id": 111, "planType": "Build", "stageName": "DEMO", "jobName": "DeployPresentation", "stageAttempt": 1, "jobAttempt": 1, "definition": { "id": 111, // pipeline id "name": "My pipeline" }, "owner": { "id": 111, // build id "name": "20210128.4" }, "result": "succeeded", "queueTime": "2021-01-28T15:10:54.8233333Z", "startTime": "2021-01-28T15:10:54.9466667Z", "finishTime": "2021-01-28T15:14:05.21Z" } |
Git
Pull request
Get
GET https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repository}/pullrequests?api-version=6.0
name | value |
---|---|
searchCriteria.creatorId | creatorId |
searchCriteria.status | active, completed, abandoned, notSet, all (active by default) |
$top | \d+ |
{ "count": 1, "value": [ { "pullRequestId": 66034, "status": "active", "createdBy": { "displayName": "Firstname Lastname", "id": "12345678-1234-1234-1234-123456789012", "uniqueName": "firstname.lastname@organization.net" }, "creationDate": "2020-12-16T17:41:23.5291166Z", "title": "PR title", "description": "description", "sourceRefName": "refs/heads/bugfix/sonar/branch-name", "targetRefName": "refs/heads/master", "mergeStatus": "succeeded", "isDraft": false, "mergeId": "12345678-1234-1234-1234-123456789012" } ] } |
Get Pull Request By Id
GET https://dev.azure.com/{organization}/{project}/_apis/git/pullrequests/{pullRequestId}?api-version=6.0
{ "pullRequestId": 12345, "status": "completed", "title": "PR title", "targetRefName": "refs/heads/master", "mergeStatus": "succeeded", "isDraft": false, } |
Work Items - List
GET https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repository}/pullrequests/{pullRequestId}/workitems?api-version=6.0
{ "count": 1, "value": [ { "id": "123456", "url": "https://dev.azure.com/{organization}/_apis/wit/workItems/123456" } ] } |
Get Pull Request Commits
GET https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/pullRequests/{pullRequestId}/commits?api-version=6.0
{ "count": 1, "value": [ { "commitId": "384d5606d55ff94bc798bca274098bf3d0022fbb", "comment": "commit message" } } |