Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,295,095
Community Members
 
Community Events
165
Community Groups

Correct customfield text in

Hello,

We were trying to create JIRA issues using the REST API. So far we've successfully created a 'barebone' ticket, by supplying the minimum fields, which proved that the route was good.

We had trouble creating the target ticket, which had mandatory custom fields. And these fields look like so from HTTP GET:

"customfield_10000": "xxx",
"customfield_20000":{
"self": "https://company.atlassian.net/rest/api/2/customFieldOption/20000",
"value": "yyy",
"id": "22222"
},

so in our HTTP POST, we specified:

"fields": {
"project": {"id": "12345"},
"summary": "foo",
"issuetype": {"id": "12345"},
"customfield_10000": "xxx",
"customfield_20000": {"id": "22222"},
}

which returned with:

error: {"errorMessages":["There was an error parsing JSON. Check that your request body is valid."]}

the 'barebone' ticket creation which succeded had:

"fields": {
  "project": {"id": "54321"}
  "summary": "foo",
  "issuetype": {"id": "10003"},
}

so it would seem the trouble-maker here were the two new customfields. What were we missing here?

1 answer

1 accepted

1 vote
Answer accepted

found the problem!

turned out that if the last JSON clause had a comma then the entire block would be treated as illegal JSON. once removed that comma, we started receiving meaningful error messages for the individual customfiels, then, by following the hints, we ended up with a correct JSON block, and the issue creation was then successful!!

hooray!!!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
Community showcase
Published in Confluence

Confluence: Where work and wellness meet

Feeling overwhelmed by the demands of work and life? With a 25% increase in the prevalence of anxiety and depression worldwide during the pandemic, for most of us, it’s a resounding yes . 🙋‍♀️ ...

867 views 11 26
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you