Azure devops api

De Banane Atomic
Aller à la navigationAller à la recherche

Links

Build

Get Build Work Items Refs

GET https://dev.azure.com/{organization}/{project}/_apis/build/builds/{buildId}/workitems?api-version=6.0
Json.svg
{
  "count": 1,
  "value": [
    {
      "id": "111"
    }

Work Item

Get Work Item

GET https://dev.azure.com/{organization}/{project}/_apis/wit/workitems/{id}?$expand=relations&api-version=6.0
Json.svg
{
  "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
Json.svg
{
  "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
Json.svg
{
  "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
Json.svg
{
  "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
Json.svg
{
  "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
Json.svg
{
  "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
Json.svg
{
  "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
Query parameters
name value
searchCriteria.creatorId creatorId
searchCriteria.status active, completed, abandoned, notSet, all
(active by default)
$top \d+
Json.svg
{
  "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
Json.svg
{
  "pullRequestId": 12345,
  "status": "completed",
  "title": "PR title",
  "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
Json.svg
{
  "count": 1,
  "value": [
    {
      "id": "123456",
      "url": "https://dev.azure.com/{organization}/_apis/wit/workItems/123456"
    }
  ]
}