Seting custom field in Youtrack Issue via API using Python

When i'm adding issue to YouTrack via Api using python (requests lib). everything works as expected. Code below:

postHeaders = {

postData = {

responsePost ="", headers=postHeaders, data=postData_json)


Than i made a custom field in Youtrack lets call it important_number.

When i add

        { "name":"important_number","$type":"SimpleIssueCustomField","value":{"name":'123'}},

to my postData, as Youtrack documentation says i got error:

{"error":"server_error","error_description":"Tried to set object to field of primitive type"}'

I'm sure that the $type and name is correct because i querry the YT for that info and paste it in code.

I have tried changig type for every other posible there is, but nothing seems to work.

While I'm using text fields like this:
 { "name":"client","$type":"TextIssueCustomField","value":{"name":description}},
got b'{"id":"2-252","$type":"Issue"}' in terminal, new issue is added, but without custom fields populated.
I am sure that in description variable is valid string.


I'm Sergey from the YouTrack team.

I suggest that you go step-by-step through this verbose approach first to find out the correct data type and values for your custom field. Additionally, you can create a new issue via a web interface and explore the browser's network records to see which request our frontend makes and then use it as an example for your case. 

If you have any questions, please let me know. 


Please sign in to leave a comment.