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
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.
In the
fields
request parameter, specify the attributes of the returned entity that you want to get in response. For example, you can request theid
andname
of the target custom field along with its updated value.-
In the request body, pass a JSON with the
name
,$type
, andvalue
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"}}]}' -
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" }