Share via

please provide a good sample request for creating release work item

Chang, Linda 0 Reputation points
2026-04-07T05:48:00.64+00:00

The guide in below url for creating release work item is not useful.

The sample request can't work. There is not sufficient information on what I have to provide in the request.

https://learn.microsoft.com/en-us/rest/api/azure/devops/wit/work-items/create?view=azure-devops-rest-7.2&tabs=HTTP

please provide a good sample request for creating release work item

Azure DevOps
0 comments No comments

3 answers

Sort by: Most helpful
  1. Siddhesh Desai 4,895 Reputation points Microsoft External Staff Moderator
    2026-04-07T16:23:53.2333333+00:00

    Hi @Chang, Linda

    Thank you for reaching out to Microsoft Q&A.

    You can refer below steps to create an Azure devops release pipeline via Rest API:

    REST API – Create Release Pipeline (Release Definition)

    Endpoint
    POST https://vsrm.dev.azure.com/{organization}/{project}/_apis/release/definitions?api-version=7.1-preview.4
    

    Replace:

    • {organization} → your Azure DevOps org name
    • {project} → your project name
    Headers (Postman)
    Content-Type: application/json 
    Authorization: Basic <BASE64_ENCODED_PAT>
    
    

    PAT format

    username:PAT

    Sample Request Body (Minimal Working Release Pipeline)

    {
      "name": "Sample-Release-Pipeline",
      "description": "Release pipeline created using REST API",
      "releaseNameFormat": "Release-$(rev:r)",
      "artifacts": [
        {
          "alias": "BuildArtifact",
          "type": "Build",
          "definitionReference": {
            "definition": {
              "id": "12",
              "name": "Sample-Build-Pipeline"
            },
            "project": {
              "id": "00000000-0000-0000-0000-000000000000",
              "name": "MyProject"
            }
          },
          "isPrimary": true
        }
      ],
      "environments": [
        {
          "name": "Dev",
          "rank": 1,
          "conditions": [],
          "preDeployApprovals": {
            "approvals": [],
            "approvalOptions": {
              "requiredApproverCount": null,
              "releaseCreatorCanBeApprover": false,
              "autoTriggeredAndPreviousEnvironmentApprovedCanBeSkipped": false
            }
          },
          "deployPhases": [
            {
              "name": "Agent phase",
              "phaseType": "agentBasedDeployment",
              "rank": 1,
              "deploymentInput": {
                "queueId": 1,
                "agentSpecification": {
                  "identifier": "windows-latest"
                }
              },
              "workflowTasks": []
            }
          ],
          "environmentOptions": {
            "emailNotificationType": "OnlyOnFailure",
            "emailRecipients": "release.environment.owner"
          }
        }
      ],
      "triggers": [],
      "variables": {
        "Env": {
          "value": "Dev",
          "allowOverride": false
        }
      }
    }
    

    Refer: https://learn.microsoft.com/en-us/rest/api/azure/devops/release/definitions/create?view=azure-devops-rest-7.1&tabs=HTTP

    0 comments No comments

  2. Chang, Linda 0 Reputation points
    2026-04-07T06:02:50.0333333+00:00

    what I need is the sample request for creating a release item, not but work item.

    0 comments No comments

  3. Q&A Assist
    2026-04-07T05:48:20.5666667+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    Below is a concrete HTTP example for creating a work item (for example, a Bug) that can be used as a “release work item” in a given project. Replace placeholders with real values.

    POST https://dev.azure.com/{organization}/{project}/_apis/wit/workitems/$Bug?api-version=7.2
    Content-Type: application/json-patch+json
    Authorization: Bearer {access_token_or_PAT}
    
    [
      {
        "op": "add",
        "path": "/fields/System.Title",
        "from": null,
        "value": "Release 2024.04 – Deployment tracking"
      },
      {
        "op": "add",
        "path": "/fields/System.Description",
        "from": null,
        "value": "Work item to track release deployment and validation.\nEnvironment: Production\nBuild: 2024.04.01.1"
      },
      {
        "op": "add",
        "path": "/fields/Microsoft.VSTS.Common.Priority",
        "from": null,
        "value": 1
      },
      {
        "op": "add",
        "path": "/fields/System.Tags",
        "from": null,
        "value": "Release;Production"
      }
    ]
    

    Key points:

    1. URL structure
      • https://dev.azure.com/{organization}/{project}/_apis/wit/workitems/$Bug?api-version=7.2
      • {organization}: Azure DevOps organization name.
      • {project}: Team project where the work item is created.
      • $Bug: Work item type. Use any valid type in the project (for example $Task, $Issue, or a custom type used for releases).
      • api-version=7.2: Explicit API version as required by Azure DevOps REST APIs.
    2. HTTP method and headers
      • Method: POST (create resource).
      • Content-Type: application/json-patch+json (required for work item create/update via PATCH document).
      • Authorization: Use a Microsoft Entra access token or a PAT as described in the authentication guidance.
    3. Body format (JSON Patch document)
      • The body is an array of operations.
      • Each operation has:
        • op: usually add when creating.
        • path: field reference, for example /fields/System.Title.
        • value: field value.
      • At minimum, provide System.Title. Other fields depend on the process template and rules in the project.
    4. Adapting for a “release work item”
      • If the project uses a custom work item type for releases (for example Release), change the URL to:
        • .../workitems/$Release?api-version=7.2
      • Add any required custom fields as additional operations, for example:
    [
      {
        "op": "add",
        "path": "/fields/System.Title",
        "value": "Release 2024.04 – Deployment tracking"
      },
      {
        "op": "add",
        "path": "/fields/Custom.ReleaseVersion",
        "value": "2024.04"
      },
      {
        "op": "add",
        "path": "/fields/Custom.Environment",
        "value": "Production"
      }
    ]
    
    1. Typical HTTP status codes
      • 200 or 201: Work item created successfully; response body contains the full work item JSON.
      • 400: Invalid field name, missing required field, or invalid value.
      • 401/403: Authentication or permission issue.

    This pattern follows the general Azure DevOps REST API request structure and HTTP method usage for creating resources.


    References:

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.