How can I edit and publish draft via API ?

Could you describe Draft fields and how can I edit them and also publish it ?
0
1 comment

Hello,

Here is an example of publishing a draft:

curl -X POST '<YouTrack address>/api/issues?draftId=2-5333' -H 'Authorization: Bearer <permanent token>' -H 'Content-Type: application/json;charset=UTF-8' -H 'Accept: application/json, text/plain, */*' -d '{"issueId":"2-5333"}'

where 2-5333 is the id of your draft.

As for updating the fields, please refer to this example: https://www.jetbrains.com/help/youtrack/devportal/api-how-to-update-custom-fields-values.html#step-by-step. However, you should send the request to https://<YouTrack address>/api/admin/users/me/drafts/<draft id> instead.

Generally, you can just open the browser console and check the requests YouTrack executes itself. This is the very same REST API.

Hope it helps. 

0

Please sign in to leave a comment.