Hi All,
Working on a project which has a Sub-task. I have a Jira API feed which is working well, Id now like to add to this API and add an image to the sub-task field "attachments".
Does anyone have a Json (application/json) example of how this can be achieved, please?
Oh I'm currently using "Postman" to test the API so if you have an example I can put in that, then great!
Thanks
James
Hello, James.
The API call should be as the following:
POST {jira_url}/rest/api/2/issue/{issueIdOrKey}/attachments
This works for issues and subtasks.
To actually send the image using postman, you need to click in body, then select form-data, in the key field you need to type "file" and then you can change the value from text to file, an option to "choose files" should appear.
Also, in order to protect against XSRF attacks, because this method accepts multipart/form-data, it has XSRF protection on it. This means you must submit a header of X-Atlassian-Token: no-check with the request, otherwise, it will be blocked.
Kind regards,
Maurício Karas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.