0
votes

I have created a new custom field in my DevOps work item type and I can see the new field via the API using _apis/wit/fields/Custom.fieldname however when I post a new work item using the API I get a 400 bad request.

I'm using version 4.1 of the DevOps API and my array of operations does contain a mixture of values in quotes and this numeric entry.

Can anyone provide me with an example json array that should be valid please?

1

1 Answers

0
votes

A 400 Bad Request usually means that your request body either is missing invalid keys or has invalid syntax.

I built a demo to test if Decimal field type will generate any problems following Create Work Item:

POST https://dev.azure.com/{organization}/{project}/_apis/wit/workitems/${type}?api-version=4.1

Request body:

[{
    "op": "add",
    "path": "/fields/System.Title",
    "from": null,
    "value": "Sample123"
},
{
    "op": "add",
    "path": "/fields/Custom.MyField",
    "value": 0.5
}]

This is working well:

enter image description here

enter image description here

This 400 problem should be caused by other part of your Request body.