Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Add attachments while creating issue via REST API

Carsten Stepan
Contributor
April 4, 2024 edited

I already read this post Solved: How to attach a file while creating Issue in JIRA ... (atlassian.com) about creating an issue and adding attachments in one go. The proposed solution here was to first create the issue and afterwards add the attachments. This is what I am currently doing.

 

However from the createmeta-Endpoint of my instance it seems I could also add attachments while creating the issue:

{
"startAt": 0,
"maxResults": 50,
"total": 16,
"fields": [
{
"required": false,
"schema": {
"type": "array",
"items": "attachment",
"system": "attachment"
},
"name": "Anhang",
"key": "attachment",
"hasDefaultValue": false,
"operations": [
"set",
"copy"
],
"fieldId": "attachment"
}]
}

Is the configuration from the endpoint whrong or how would do that in a single step? I tried it using the following request in curl:

 

curl -H "Authorization ..." https://myinstance.atlassian.net/rest/api/3/issue -X POST -d '{
"fields": {
"project": { "id": "1234" },
"summary": "my summary",
"description": "my description",
"issuetype": { "name": "Story" }
}
}'

 but unsure how to provide the attchment here (if at all).

0 answers

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events