I am trying to add a document to confluence page. I am using this code :
E:\APP\"curl-7.53.1"\src\curl.exe -v -S -u user:password -X POST -H "X-Atlassian-Token: no-check" -F "file=@C:\Users\srvc_mdw_dev\Desktop\conf.txt" -F "comment=this is my file" "http://confluence.example.net/rest/api/content/36375143/child/attachment"
But i get the following error :
PS E:\PowerShell\script> ./confNote: Unnecessary use of -X or --request, POST is already inferred. * timeout on name lookup is not supported* Trying IPaddress... * TCP_NODELAY set * Connected to confluence.example.net (ip address) port 80 (#0) * Server auth using Basic with user 'user' > POST /rest/api/content/36375143/child/attachment HTTP/1.1 > Host: example.com> Authorization: Basic c291aGFpbC5vdWFiaUBtZXRyb2V4dGVybmFsLmZyOm1ldHJvNDU2Kg== > User-Agent: curl/7.53.1 > Accept: */* > X-Atlassian-Token: no-check> Content-Length: 333 > Expect: 100-continue > Content-Type: multipart/form-data; boundary=------------------------646f724e33da0066 > * HTTP 1.0, assume close after body< HTTP/1.0 302 Found < Location: https://example.net/rest/api/content/36375143/child/attachment< Server: BigIP * HTTP/1.0 connection set to keep alive! < Connection: Keep-Alive < Content-Length: 0 * HTTP error before end of send, stop sending< * Closing connection 0
I think the Error is in the URI but i'm not sure. Can someone help me please, I've been stuck in this one for a long time. Thank you in advance
Dear @Souhail OUABI,
it's a pity, that no one managed to answer this one within nearly one year.
First of all, I checked the command on Linux with curl 7.47.0 (x86_64-pc-linux-gnu):
curl -v -S -u admin:********** -X POST -H "X-Atlassian-Token: no-check" -F "email@example.com" -F "comment=this is my file" http://localhost:8090/rest/api/content/1234567/child/attachment
The command worked pretty fine. The command has a different format on Linux than yours, but is equal.
The output header/debug information:
Note: Unnecessary use of -X or --request, POST is already inferred.
* Trying localhost ...
* Connected to localhost (188.8.131.52) port 8090 (#0)
* Server auth using Basic with user 'admin'
> POST /rest/api/content/1234567/child/attachment HTTP/1.1
> Host: localhost:8090
> Authorization: Basic YQRtaX46YRRtaW5=
> User-Agent: curl/7.47.0
> Accept: */*
> X-Atlassian-Token: no-check
> Content-Length: 639703
> Expect: 100-continue
> Content-Type: multipart/form-data; boundary=------------------------82221eb8fc60820b
< HTTP/1.1 100 Continue
< HTTP/1.1 200 OK
< Server: Apache-Coyote/1.1
< X-ASEN: SEN-123456789
< Set-Cookie: JSESSIONID=23D5EBEF17C15604DA732470D7EE55D2; Path=/; HttpOnly
< X-Seraph-LoginReason: OK
< X-AUSERNAME: admin
< X-Content-Type-Options: nosniff
< Content-Type: application/json
< Transfer-Encoding: chunked
< Date: Wed, 31 Jan 2018 22:43:59 GMT
Next I have to look for a powershell and repeat it.
Hang on, meanwhile, will not take another year, for sure!
Same command was pretty fine on a power shell (win10) with curl 7.58.0 win64 generic.
So in your case it could be a buggy curl version.
Or following the HTTP error code 302, this could mean that the page was redirected. This can be caused by a bad configured proxy.
Most of us don’t need much convincing that stakeholder management is important. It just makes sense that keeping everyone in-the-know on projects and assigning clearly defined roles is key to having ...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs