YouTrack Standalone 2019.3 Help

Update a Text Field Value

Use Case:

Use the REST API to update the value stored in a custom field with text type.

Summary

Make a POST request to the following endpoint: /api/issues/{issueID}?[fields]

Step-by-Step

  1. To update a custom text field in an issue, send a POST request to the target issue. You can reference the issue by issue ID or issue entity ID.

  2. In the fields request parameter, specify the attributes of the returned entity that you want to get in response. For example, you can request the id and name of the target custom field along with its updated value.

  3. In the request body, pass a JSON with the name, $type, and value for the text field that you want to update.

    So, the final request is:

    curl -X POST 'https://example.myjetbrains.com/youtrack/api/issues/NP-98?fields=customFields(id,name,value(text))' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer perm:cm9vdA==.MjZGZWI=.WB02vjX0cM2ltLTJXUE3VOWHpJYYNx' \ -H 'Content-Type: application/json' \ -d '{"customFields":[{"name":"Customer","$type":"TextIssueCustomField","value":{"text":"Valued Customer"}}]}'
  4. To confirm that the target issue text field was set to the corresponding value, let's check the response from the server:

    { "customFields": [ ... { "value": { "text": "Valued Customer", "$type": "TextFieldValue" }, "name": "Customer", "id": "194-4", "$type": "TextIssueCustomField" } ], "$type": "Issue" }
Last modified: 16 March 2020