Creating a draft issue via API

I am trying to simplify the workflow for QA when they want to create a new issue from our game. My ideal workflow is: click a button in-game, the game creates a draft issue, attaches log files and screenshots and then opens the newly-created draft issue in the user's browser for them to edit and submit.

My reason for wanting to keep these as drafts is I don't want our YouTrack to become messy with half-finished issues.

I've seen how to create non-draft issues in the API and attach files. But how do I create draft issues?

0
6 comments

Hi,

Thank you for contacting YouTrack forums. I'm sharing an example of creating a draft with summary and description:

curl -X POST 'https://<YouTrack address>/api/admin/users/me/drafts?fields=description,updated,applicableActions(description,id)' -H 'Authorization: Bearer <token>' -H 'Content-Type: application/json;charset=UTF-8' -H 'Accept: application/json, text/plain, */*' -d '{"project":{"shortName":"SP"},"summary":"Hey draft!","description":"I am a draft"}'

The created draft can be later found in the Drafts section of the user whose token was used in the request. Please note that a draft can belong to its creator only, so they will be visible only to one user.

Please feel free to adjust this request further to modify custom fields or include attachments. Hope it helps. 

0

Can you add drafts to API documentation ? There is absolutely no mentions of this resource path or draft entity

0
Hi,

I have shared your feedback with the documentation team. Please note that not all API endpoints are public yet. We can't guarantee all endpoints will be public and docuemnted, unfortunately.
0

Hi Anastasia, 

Can you confirm that your example still working? Seems that something happened (maybe an update on YouTrack servers) and now your example returned 

{"error":"Not Found","error_description":"HTTP 404 Not Found"}

Few months ago the same code snippet working for me OK. If you are able to provide any information, please let me know. Thank you.

 

 

0

I found the cause of the problem 

Now, for some reasons we have to use 

https://<YouTrack address>/api/users/me/drafts

instead of 

https://<YouTrack address>/api/admin/users/me/drafts

 

0
Hello,

I'm Lena from the YouTrack Team.

Could you please describe your final goal? Do you wish to create a draft or create an issue based on any draft?
0

Please sign in to leave a comment.