I'm trying to add an attachment to some Issue that I created through the Jira API.
On the documentation there is only a curl example but I can't install this for some reason. I just want to know what the request would look like wo curl. I'm using for my website in php.
hi here you find the python script
If you find this answer useful, I would kindly ask you to like and share it so the same will be visible to others who might be facing the same issue you have inquired.Thank you for your understanding.
# =============== # greeting.txt # =============== hello, world # =============== # upload.attachment.py # =============== import requests import json # [JIRA-BASE-URL], i.e.: http://localhost:8080 # [ISSUE-ID], i.e.: ATT-1 url = '[JIRA-BASE-URL]/rest/api/2/issue/[ISSUE-ID]/attachments' headers = {"X-Atlassian-Token": "nocheck"} # please uncomment to attach external file files = {'file': open('greeting.txt', 'rb')}
...........................
Hi @Bastet DT ,
The curl example is just intended to show what needs to be provided when sending an HTTP POST request to the Jira REST API endpoint in order to add an attachment to an issue. You can just provide the same data in any other way without using curl.
In the below threads you can find examples showing how to add an attachment using PHP or Java or python. Just keep in mind that there are differences depending if you are using Jira Cloud or Server (e.g. In Cloud you must use email address and api-token instead of username and password to authenticate):
Please review above threads and let us know if they help. In case they don't please try to provide more details on what you are trying to achieve.
Cheers,
Dario
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.