Forums

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

Getting a 301 moved when attempting to execute rest api call (Post) to attachments.

Jose_Bonilla
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 7, 2019

Hey everyone,

 

Trying to add some automation to how we attach certain items to our tickets. 

The following is the command I am attempting, but I'm getting a 301 moved on this. I'm having difficulty locating the documentation. This is with Jira Cloud.

`curl -u user:key -X POST -H "X-Atlassian-Token: no-check" -F "file=@somefile.txt" http://<org>.atlassian.net/rest/api/3/issue/<issue>/attachments/ -D-`

Please advise.

- Jose

1 answer

1 accepted

0 votes
Answer accepted
Jose_Bonilla
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 7, 2019

This has been resolved. Looks like I needed both of these headers:

`curl -F "file=@somefile.txt" -u user:token --request POST \
--url 'https://<org>.atlassian.net/rest/api/3/issue/<issue>/attachments' \
--header 'Accept: application/json' \
--header 'X-Atlassian-Token: no-check'`

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events