'Azure Devops Area API
I have found and successfully tested creating an Area for a project via the API.
{ "name": "Web" }
This as default creates an Area which is a Child of the Project Area.
Project Name > Area Name
I cannot see a method online of creating an Area via the API which is nested in multiple Areas (Child) so in the example below via API I want to create the "Child Area Name":
Project Name > Area 1 Name > Child Area Name
If anyone has done this before please could you provide any suggestions.
Solution 1:[1]
I remember having the same challenge sometimes ago, and eventually used a different API to create sub areas. Here's what I did:
Every Area path (and Iteration paths) has their unique IDs. You can retrieve all the area paths (or iteration paths) using the documented REST APIs. For example, you can use the following API to get all the area paths (you can decide the depth you want to query)
https://dev.azure.com/{Org}/{project}/_apis/wit/classificationnodes/Areas?$depth={depth}&api-version=6.0
The above will give you a hierarchical structure for every nodes with their unique IDs. You need to grab the ID of the node/sub-node under which you want to create the next sub-area. Next you can create a payload like below:
{
operationData: "{ \"NodeName\": \"Sub-Area1\", \"ParentId\": \"Parent-GUID-You-Got-Earlier\" }", // Notice the value here is already serialized
syncWorkItemTracking: false
}
Finally, post the above payload to the following URI:
var uri = "https://dev.azure.com/{Org}/{projectId}/_admin/_Areas/CreateClassificationNode?useApiUrl=true&__v=5"
It will create the sub-area and will return the ID of the newly created sub-area Node info (including ID).
Hope this help you get going.
PS: If anybody could shared who figured out how to achieve the same using the standard/documented API please share.
Solution 2:[2]
You should be able to add the path property to your POST request to create the area under a sub path:
{
"name": "Child Area Name",
"path": "/area 1 name"
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Moim |
| Solution 2 | jessehouwing |
