Forums

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

I am unable to attach any file to an existing confluence page using the api.

Marian Ionescu
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!
January 30, 2019

 

 

I am using Confluence 6.3.4.

I've been trying for a while to attach a file to an existing confluence page using the documentation available on the website. 

curl -v -S -u admin:admin -X POST -H "X-Atlassian-Token: no-check" -F "file=@myfile.txt" -F
"comment=this is my file" "http://localhost:8080/confluence/rest/api/content/3604482/child/attachment"
| python -mjson.tool

This is my curl command :

curl -v -S -u MyUserName:MyPassword -X POST -H "X-Atlassian-Token: no-check" -F "file=@C:\Users\MyUser\Desktop\table.txt" -F "comment=this is my file" https://confluence.mycompany.com/rest/api/content/{IDOfPageWhereToAddTheAttachment}/child/attachment

 This is what I receive back ( I've changed the ip addresses). I have already searched online for similar issues but was unable to find a solution. Can anybody help me ? 

Note: Unnecessary use of -X or --request, POST is already inferred.
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Trying 10.70.70.70...
* TCP_NODELAY set
* Connected to confluence.mycompany.com (10.70.70.70) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
* CAfile: C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
CApath: none
* TLSv1.2 (OUT), TLS header, Certificate Status (22):
} [5 bytes data]
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
} [512 bytes data]
* TLSv1.2 (IN), TLS handshake, Server hello (2):
{ [62 bytes data]
* TLSv1.2 (IN), TLS handshake, Certificate (11):
{ [3988 bytes data]
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
{ [333 bytes data]
* TLSv1.2 (IN), TLS handshake, Server finished (14):
{ [4 bytes data]
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
} [70 bytes data]
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
} [1 bytes data]
* TLSv1.2 (OUT), TLS handshake, Finished (20):
} [16 bytes data]
* TLSv1.2 (IN), TLS change cipher, Change cipher spec (1):
{ [1 bytes data]
* TLSv1.2 (IN), TLS handshake, Finished (20):
{ [16 bytes data]
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN, server did not agree to a protocol
* Server certificate:
* subject: C=US; ST=State; L=Location; O=mycompany , Incorporated; OU=IT; CN=*.mycompany.com
* start date: Feb 21 00:00:00 2018 GMT
* expire date: Feb 26 12:00:00 2020 GMT
* subjectAltName: host "confluence.mycompany.com" matched cert's "*.mycompany.com"
* issuer: C=US; O=DigiCert Inc; OU=www.digicert.com; CN=DigiCert SHA2 High Assurance Server CA
* SSL certificate verify ok.
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Server auth using Basic with user 'MyUserName'
} [5 bytes data]
> POST /rest/api/content/{IDOfPageWhereToAddTheAttachment}/child/attachment HTTP/1.1
> Host: confluence.mycompany.com
> Authorization: Basic U1ZDX1U19Vc2VyOkhhcm1hbixMjM0
> User-Agent: curl/7.61.1
> Accept: */*
> X-Atlassian-Token: no-check
> Content-Length: 302
> Content-Type: multipart/form-data; boundary=------------------------240ca1e3b9c1c74b
>
} [5 bytes data]
< HTTP/1.1 302 Found
< Content-Length: 225
< Content-Type: text/html; charset=iso-8859-1
< Date: Wed, 30 Jan 2019 11:26:38 GMT
< Location: https://confluence.mycompany.com/confluence/
< RVBD-CSH: 10.10.20.20
< RVBD-SSH: 10.10.30.30
< Server: Apache/2.4.6 (Red Hat Enterprise Linux) OpenSSL/1.0.2k-fips
< Strict-Transport-Security: max-age=15768000
< X-RBT-SCAR: 10.10.20.20:7155841:1000
* HTTP error before end of send, stop sending
<
{ [5 bytes data]
100 527 100 225 100 302 849 1139 --:--:-- --:--:-- --:--:-- 1988<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>302 Found</title>
</head><body>
<h1>Found</h1>
<p>The document has moved <a href="https://confluence.mycompany.com/confluence/">here</a>.</p>
</body></html>

* Closing connection 0
} [5 bytes data]
* TLSv1.2 (OUT), TLS alert, close notify (256):
} [2 bytes data]

 

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events