Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,554,892
Community Members
 
Community Events
184
Community Groups

response of REST API

Edited

Hello, 

 

when i call the JIRA REST API to create an issue

rest/api/2/issue

i get the responst in JSON format.

 

when attaching a File to that issue

rest/api/2/issue/xxx/attachments

i get the response in JSON format, but with surrounding "[]"-braces. 

 

why that?

best regards

Lars

 

Info: 

"version""8.12.3"

2 answers

0 votes
David Bakkers
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 12, 2023

Because that's the expected behaviour, as per the documentation:

POST /rest/api/2/issue/{issueIdOrKey}/attachments

Add one or more attachments to an issue.

Since you can attach 1 or more, the response has be an array of 1 or more objects, which is shown in the example response provided in the documentation:

[
{
"self": "http://www.example.com/jira/rest/api/2.0/attachments/10000",
"filename": "picture.jpg",
<blah blah>,
},
{
"self": "http://www.example.com/jira/rest/api/2.0/attachments/10001",
"filename": "dbeuglog.txt",
<blah blah>
}
]

Hello David,

thank you for the answer, that makes sense..

Lars

Like David Bakkers likes this
0 votes
Radek Dostál
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 12, 2023

Are you asking us why we developed an endpoint to return a JSON array instead of what you expect, a JSON object?

We didn't. You're asking us design questions, this is a community, not an atlassian dev hub / coffee room.

Suggest an answer

Log in or Sign up to answer