azure-devopsazure-logic-appsazure-devops-rest-apitfs-workitem

How to close all the other related work items when a work item is closed?


Actually, I am writing MSFlow to automate some DevOps actions. I am able to retrieve all the related work items of a work item through the below API.

https://dev.azure.com/{organizationname}/_apis/wit/workitems?ids=600&$expand=all&api-version=6.0

But I don't know how to close \ how to change the state of those work items automatically. I can't see any APIs. Can someone help me with this?


Solution

  • You can use the Work Items - Update API:

    PATCH https://dev.azure.com/{organization}/{project}/_apis/wit/workitems/{id}?api-version=6.1-preview.3
    

    In the body update the State field:

    {
      "op": "add",
      "path": "/fields/System.State",
      "value": "Closed"
    }