1

Trying to use REST API to create iterations for a project using POST as per this:

https://learn.microsoft.com/en-us/rest/api/azure/devops/work/iterations/post%20team%20iteration?view=azure-devops-rest-5.1

However I keep getting a 400 response.

Curiously I added one in the UI (Iteration 3) - and when I request the results it does not include the new one.

Is there an issue with this not really working properly or am I doing something wrong?

https://dev.azure.com/{organization}/{projectId}/{teamId}/_apis/work/teamsettings/iterations?api-version=5.0

enter image description here

{
count: 3,
value: [
{
id: "f95df712-1f2d-4685-86ea-b2e7dbad8353",
name: "Iteration 0",
path: "CMMI2\Iteration 0",
attributes: {
startDate: null,
finishDate: null,
timeFrame: "current"
},
url: "https://dev.azure.com/{organization}/{projectId}/{teamId}/_apis/work/teamsettings/iterations/f95df712-1f2d-4685-86ea-b2e7dbad8353"
},
{
id: "ec4f29f0-0b48-4a52-9b71-45e396654330",
name: "Iteration 1",
path: "CMMI2\Iteration 1",
attributes: {
startDate: null,
finishDate: null,
timeFrame: "future"
},
url: "https://dev.azure.com/{organization}/{projectId}/{teamId}/_apis/work/teamsettings/iterations/ec4f29f0-0b48-4a52-9b71-45e396654330"
},
{
id: "ab3d8626-c613-48ff-9378-f3b7ed109d77",
name: "Iteration 2",
path: "CMMI2\Iteration 2",
attributes: {
startDate: null,
finishDate: null,
timeFrame: "future"
},
url: "https://dev.azure.com/{organization}/{projectId}/{teamId}/_apis/work/teamsettings/iterations/ab3d8626-c613-48ff-9378-f3b7ed109d77"
}
]
}
1
  • you'll have to do 2 requests. first create the classificationnode and then assign that classificationnode using the iterations-api Commented May 22, 2019 at 8:00

2 Answers 2

2

To create new iteration, you have to use another urls. You can find them here: Classification Nodes - Create Or Update. Sample of Create iteration:

POST https://dev.azure.com/fabrikam/Fabrikam-Fiber-Git/_apis/wit/classificationnodes/Iterations?api-version=5.0

Request Body

JSON

{
"name": "Final Iteration",
"attributes": {

"startDate": "2014-10-27T00:00:00Z",

"finishDate": "2014-10-31T00:00:00Z"

}

}

Sign up to request clarification or add additional context in comments.

1 Comment

Is there a way to use this across multiple projects within the organisation? I've just tested this and it fails because the Iteration Name is already in use.
0

You don't see the new iteration because you added the iteration in Project configuration only, the Rest API is related to "team settings".

You need also to add the iteration in Team configuration (when you click on it you have tab "iterations", then click "Select iteration(s)" and select the new one).

If you want help about the creating iteration you must share here all the code you tried.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.