0

I am getting an error message when using the Azure DevOps REST API (regardless of version).

Running POST https://dev.azure.com/{organisation}/{project}/_apis/wit/classificationnodes/Areas?api-version=7.1-preview.2

with a body payload

{ "name": "Very nice area" }

Does not execute and an error is returned.

"status": 415, "message": "TF400898: An Internal Error Occurred.....

From the MS article below I'd expect to have an Area created for the given Organisation and project in the URL. Note that I do not have an issue using other REST API calls to the same DevOps organisation.

https://learn.microsoft.com/en-us/rest/api/azure/devops/wit/classification-nodes/create-or-update?view=azure-devops-rest-7.2&tabs=HTTP

I've tried adding the path in the body and the URL and various versions of the API. I'm able to update work items in the same organisation. I also get the same error when trying Iterations as well as Area.

1 Answer 1

2

"status": 415, "message": "TF400898: An Internal Error Occurred.....

From the error message, the 415 status indicates Unsupported Media Type error. The issue could be related to the Post Headers.

We need to set the Content-Type to application/json.

You can refer to the following PowerShell script to run the Rest API:

$token = "PAT"



$url="https://dev.azure.com/OrganizationName/ProjectName/_apis/wit/classificationnodes/Areas?api-version=7.1-preview.2"

$token = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes(":$($token)"))

$JSON = @'
{
    "name": "Very nice area" 
}
'@

$response = Invoke-RestMethod -Uri $url -Headers @{Authorization = "Basic $token"} -Method Post -Body $JSON -ContentType application/json

If you are using Postman, you can refer to the following headers.

enter image description here

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

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.