Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Proper syntax to POST task in JIRA project with customfield

hamelj
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 6, 2019

I have been mandated to create TASKS in a JIRA project via XMLHTTP POST request.

I have overcome, connectivity and authorization.

But I keep getting baffled with errors that keep coming when I try to send values from drop-down list.

I have queried my JIRA project in order to get the list of fields, their type, ID, etc... (see attached fields.png)

fields.PNG

No matter what I try, I always get errors for single-select customfield.

If I assigned the value like this:

{"value","13716"}

I get this error:

Field with id 'customfield_12120' named 'Department' has these errors : Option id 'null' is not valid"

in what was returned to me by JIRA upon my request for fields, I do not see an ID for tany of the validValues. I have searched  for that error but what I found wasn't conclusive so I tried this:

{"id":"12120","value":"13716"}

or

{"id":"0","value":"13716"}

I get this error:

Please provide a valid value for field 'Department'

Now if you look at the image above, you will see that the value 13716 is a valid value.

I am lost...anyone got an idea?

1 answer

0 votes
hamelj
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 6, 2019

Upon testing some more, it seems that the proper syntax, when you have multiple choice, is to use the "value" as the "id" and it works as so:

{"id":"13716"}

 

Now that is working, one last problem...anyone knows the proper syntax for a custom field of type "user" which end-up being a "userpicker"?  what would be the proper return syntax?

I tried this:

{"name":"Albert Einstein"} but that doesn't seems to do it. Keeps giving me this:

Please provide a valid value for field 'Supervisor'

Suggest an answer

Log in or Sign up to answer