How to create a work item with custom field values populated ​​using Rest API?

Volantis Jan 20 Reputation points
2025-03-20T08:29:16.59+00:00

I have a custom field on work items (Task) called "VOLAN".

By following this document : https://learn.microsoft.com/en-us/rest/api/azure/devops/wit/work-items/create?view=azure-devops-rest-7.1&tabs=HTTP try sending the following content to the API endpoint and getting 200 responses. But the value is not populated when checking it from ADO UI.

[
  {
    "op": "add",
    "path": "/fields/System.Title",
    "from": null,
    "value": "Sample task",
    fields: [
        {"System.VOLAN" : TestValue}  
    ]   
 } 
]

Can't figure it out, any help would be greatly appreciated.

Azure DevOps
0 comments No comments
{count} votes

Accepted answer
  1. Kantamsetti Aslesha 250 Reputation points Microsoft External Staff
    2025-03-21T04:43:33.9433333+00:00

    Hi @Volantis Jan
    The issue with your request is that the fields property does not belong inside the patch request body. In Azure DevOps REST API, each field must be added individually with its proper reference name.

    [
      {
        "op": "add",
        "path": "/fields/System.Title",
        "value": "Sample Task"
      },
      {
        "op": "add",
        "path": "/fields/Custom.VOLAN",
        "value": "<YourValue>"
      }
    ]
    
    
    

    By using above Request Body I was successfully set the Custom Field Value as shown below:

    2025-03-21 11_47_38-New Request - azure-health-check - Visual Studio Code

    2025-03-21 11_50_55-Task 3 Sample Task and 15 more pages - Work - Microsoft​ Edge

    Hope this helps.

    If the answer is helpful, please click Accept Answer and kindly upvote it. If you have any further questions about this answer, please click Comment.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.