I am using a V3 rest API to create a Jira ticket. I need to add multiple mentions in the description. I can add one mention in the description but when I try to add two, Jira complains that "There was an error parsing JSON. Check that your request body is valid." Can somebody please tell me what is wrong with the body. Thanks!
{ "update": {}, "fields": { "summary": "Test JIRA ticket", "issuetype": { "name": "Task" }, "project": { "key": "BRETRO" }, "reporter": { "id": "BCD-ABC-ABC-ABC" }, "assignee": { "id": "XYZ-ABC-ABC-ABC" }, "description": { "type": "doc", "version": 1, "content": [ { "type": "paragraph", "content": [ { "text": "Description", "type": "text" }, { "type": "hardBreak" }, { "type": "mention", "attrs": { "id": "ABC-ABC-ABC-ABC" } }, { "type": "text", "text": " " }, { "type": "mention", "attrs": { "id": "ABC-ABC-ABC-DEF" } } ] } ] } } }
Hi @paul_dunk -- Welcome to the Atlassian Community!
To use ADF with the Description, I believe that field must be in "update" with a "set" operation, even though you may put the other fields under "fields".
Please try this one:
{"fields":{"summary":"Test JIRA ticket","issuetype":{"name":"Task"},"project":{"key":"BRETRO"},"reporter":{"id":"BCD-ABC-ABC-ABC"},"assignee":{"id":"XYZ-ABC-ABC-ABC"}},"update":{"description":[{"set":{"type":"doc","version":1,"content":[{"type":"paragraph","content":[{"text":"Description","type":"text"},{"type":"hardBreak"},{"type":"mention","attrs":{"id":"ABC-ABC-ABC-ABC"}},{"type":"text","text":" "},{"type":"mention","attrs":{"id":"ABC-ABC-ABC-DEF"}}]}]}}]}}
I recommend uncompressing / formatting that expression and reviewing it before use.
Kind regards,
Bill
PS: Would one of the community leaders / managers please move this question from App Central to the Jira product, questions area? Thank you!
Thanks very much Bill. I entered the expression in JSON formatter and it looked good to me. Unfortunately, Jira still had an error parsing the body.
Also, thanks for asking to have this question moved to the Jira product area.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I tested that JSON, substituting in my own Project Key and user accountId values for the mentions, reporter, and assignee and it worked (from an automation rule test action).
I recommend pausing and trying a basic Get Issue with whatever tooling you are using to confirm that is working first. And if that works...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Bill. That's interesting, encouraging and frustrating. I will take a closer look at what I am actually sending and compare it to your expression.
Both the GET and incremental create ideas are good advice.
My GET works. If I have manually entered two mentions in the issue, then they display with the notation that I am using for my POST.
The create works up until I add the second mention.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Is that error from your request / tool before sending, or a response from the endpoint request?
Also, I note you try to add a single space between the mentions. Try putting some other text in there for more visibility between the entries. Perhaps there is something in your JSON parser / validator which is collapsing the space and does not like the empty string in the message.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.