Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.
×API : yourdomain/3/issue/abc-123/comment
{ "body": { "type": "doc", "version": 1, "content": [ { "type": "paragraph", "content": [ { "text": "test comment with attchment", "type": "text" } ] }, { "type": "mediaSingle", "attrs": { "layout": "center" }, "content": [ { "type": "media", "attrs": { "id": "113562", "type": "file", "collection": "attachment" } } ] } ] } }
"{\"errorMessages\":[\"ATTACHMENT_VALIDATION_ERROR\"],\"errors\":{}}"
issue/{issueId}/comment
Hi @Laxman Khokhar ,
The payload structure is correct, but the catch here is that the attachment ID it requires is not what we expect - this ID needs to be looked up via the Media API, and this can be quite tricky, but here's a post on this if you're interested.
Alternatively, an easier way would be to insert the attachment as an external URL instead (outlined here), where we can use the "regular" Jira attachment ID. I've tested this and seems to work fine!
{
"body": {
"type": "doc",
"version": 1,
"content": [
{
"type": "mediaSingle",
"content": [
{
"type": "media",
"attrs": {
"type": "external",
"url": "https://<instance-name>.atlassian.net/rest/api/3/attachment/content/10000"
}
}
]
}
]
}
}
{ "body": { "type": "doc", "version": 1, "content": [ { "type": "paragraph", "content": [ { "type": "text", "text": "Test comment" } ] }, { "type": "mediaSingle", "content": [ { "type": "media", "attrs": { "id": "113844", "type": "external" } } ] } ] } }
i m passing above json payload to save comment and give a error {"errorMessages":["INVALID_INPUT"],"errors":{}} how to resolve this issue and anything else from my end in header in passing?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Laxman Khokhar ,
From the latest payload you provided, it looks like you're still passing in the "id" directly, but it should be a "url" attribute. The attrs object should be as follows:
"attrs": {
"type": "external",
"url": "https://<instance-name>.atlassian.net/rest/api/3/attachment/content/<Jira-Attachment-ID>"
}
As for the headers, the docs example includes these two:
Accept: application/json
Content-Type: application/json
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.