How to update the value of a WorkItemAttribute?
Hey there! This is my first question here: I want to update a certain IssueWorkItem, to change the value of a specific WorkItemAttribute.
This is part of the attributes of my IssueWorkItem:
"attributes": [
{
"name": "Billability",
"value": {
"name": "Billable",
"id": "172-0",
"$type": "WorkItemAttributeValue"
},
"id": "173-12",
"$type": "WorkItemAttribute"
},
...
]
In this case, I want to change the value from "Billable" to "Not billable", which is ID 172-1.
The documentation sais:
To update an attribute, provide it in the body of a POST request.
(see https://www.jetbrains.com/help/youtrack/devportal/api-entity-WorkItemAttribute.html ).
But how?
Please sign in to leave a comment.
Hi!
I'm Sergey from the YouTrack team.
The endpoint itself is not documented at the moment. As a workaround, you can change the value in the UI and examine the browser's network records to see which API requests the frontend makes. Then you can emulate them in your own integration. However, I should note that as the endpoints are not documented, they might be changed in the future without prior notifications.
Some basic example that you'll see in the network records:
Hi Sergey,
thank you very much for your quick response and pointing the direction! In my case, I managed to update the attribute value as follows:
POST {{baseUrl}}/issues/:id/timeTracking/workItems/:issueWorkItemId?muteUpdateNotifications
{
"attributes": [
{
"value": {
"id": "172-2"
},
"id": "173-23"
}
]
}
Regards,
Simon
Thanks for sharing the example. Glad to hear that you found the solution for your case.