Here is the command that I am using:
curl -v -S -X POST -H "Authorization: Bearer $WIKI_TK" -F "file=@image.png" "https://company.com/confluence/rest/api/content/12345/child/attachment"
I am able to download pages, upload pages, download attachments, etc.
But getting stuck on uploading an attachment.
* We are completely uploaded and fine
< HTTP/1.1 302
< X-Confluence-Cluster-Node: asdfasdf
< Set-Cookie: JSESSIONID=fasdfasdfasd; Path=/; Secure; HttpOnly
< X-Seraph-LoginReason: OK
< X-AUSERNAME: asdfasdfasdf
< X-XSS-Protection: 1; mode=block
< X-Content-Type-Options: nosniff
< X-Frame-Options: SAMEORIGIN
< Content-Security-Policy: frame-ancestors 'self'
< Location: /login.action?os_destination=%2Fconfluence%2Frest%2Fapi%2Fcontent%asdfasdfasdf%2Fchild%2Fattachment&permissionViolation=true
< Content-Length: 0
<
Edit:
Adding -H 'X-Atlassian-Token: nocheck' leads to same result (error code 302)
curl -v -S -X POST -H "Authorization: Bearer $WIKI_TK" -H 'X-Atlassian-Token: nocheck' -F "file=@image.png" "https://company.com/confluence/rest/api/content/12345/child/attachment"