good afternoon I'm creating a file to open an issue in jira service management but I needed to attach files, which parameter can I include in the json?
Hi Wagner,
Thanks for reaching out to the Atlassian Community!
From the description, I think you are trying to write a script that will create a JSM issue with the attachment.
If you do, we can not pass a path to the file in the JSON request parameter. Instead, your script will need to call two JSM REST APIs (assuming you are using JSM Cloud)
1. Call the REST API to create an issue
For example:
curl --request POST --url https://your-domain.atlassian.net/rest/api/3/issue -u 'email@example.com:<api_token>' --data '{"fields": {"summary": "Test the automation","issuetype": {"id": "<issuetype-id>"},"project": {"key": "IP"},"description": {"type": "doc","version": 1,"content": [{"type": "paragraph","content": [{"text": "This is the description.","type": "text"}]}]}}}' --header 'Accept: application/json'
When the issue is created successfully, you will receive a response similar to below:
{
"id": "10000",
"key": "IP-16",
"self": "https://your-domain.atlassian.net/rest/api/3/issue/10000",
}
Grab that Issue id in your script.
2. Then, call another REST API to add an attachment
For example:
curl --location --request POST 'https://your-domain.atlassian.net/rest/api/3/issue/IP-26/attachments' -u 'email@example.com:<api_token>' -H 'X-Atlassian-Token: no-check' --form 'file=@"a.png"'
I hope it helps.
Cheer!
duplicate answer (removed)
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.