upload attachment via curl shows 404 not found

Nurlan Izimbetov October 6, 2023

Hello everyone.

 

i'm trying to upload file as attachment via curl... but it's shows 404 not found...

i'm following this documentation:

https://developer.atlassian.com/cloud/confluence/rest/v1/api-group-content---attachments/#api-wiki-rest-api-content-id-child-attachment-post

 

HTTP/2 404
date: Fri, 06 Oct 2023 09:06:38 GMT
content-type: application/xml;charset=UTF-8
server: AtlassianEdge
timing-allow-origin: *
x-arequestid: 3da2ee41054a480bb06bf2294bf9e3b5
x-seraph-loginreason: AUTHENTICATED_FAILED
set-cookie: atlassian.xsrf.token=a5248455223e43f38a29df9ca9ded53d7fdea435_lout; Path=/; SameSite=None; Secure
cache-control: no-transform
vary: Accept
x-content-type-options: nosniff
x-xss-protection: 1; mode=block
atl-traceid: b94c2e625f098e4c
report-to: {"endpoints": [{"url": "https://dz8aopenkvv6s.cloudfront.net"}], "group": "endpoint-1", "include_subdomains": true, "max_age": 600}
nel: {"failure_fraction": 0.001, "include_subdomains": true, "max_age": 600, "report_to": "endpoint-1"}
strict-transport-security: max-age=63072000; includeSubDomains; preload

 

curl -D- \
-u nurlan.i@domain.com:mypasswd \
-X POST \
-H 'X-Atlassian-Token: nocheck' \
-F 'file=@"helmsman.git"' \
-F 'minorEdit="true"' \
-F 'comment="Example attachment comment"; type=text/plain; charset=utf-8' \
https://mydomain.atlassian.net/rest/api/content/11111111/child/attachment

 

2 answers

0 votes
Nurlan Izimbetov October 6, 2023

image.png

Nurlan Izimbetov October 6, 2023

still 404 error.

Andrii Maliuta
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.
October 6, 2023

@Nurlan Izimbetov 

Just to clarify do you need to upload Attachment to Confluence or Jira? :)

The error says that you hit the JIRA url, so there must be smth wrong with the endpoint.

The following endpoint should work fine for adding attachments to Confluence as you have '/wiki' after the .net domain and the correct page ID should be present:

https://xxx.atlassian.net/wiki/rest/api/content/467370120/child/attachment

Please make sure the page ID is correct :) 

Nurlan Izimbetov October 6, 2023

i need upload attachment to Confluence Cloud.

 

as URL i'm using: https://xxx.atlassian.net/wiki/rest/api/content/870219811/child/attachment

 

 

Thank you.

Continue troubleshooting. 

0 votes
Andrii Maliuta
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.
October 6, 2023

Hello @Nurlan Izimbetov ,

Seems like you missed the '/wiki' part for Confluence URL:

https://mydomain.atlassian.net/wiki/rest/api/content/11111111/child/attachment
Nurlan Izimbetov October 6, 2023

almost fixed, i got 401 unathorized.

 

as login i'm using e-mail and password.

Suggest an answer

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

Atlassian Community Events