We are in the process of migrating this forum. A new space will be available soon. We are sorry for the inconvenience.

How to upload image/jpeg with API ?


ThomasD
10-06-2014, 10:44 PM
I trie to use the API and I have a problem when I put image on hubic.

The autentification is ok and I have a good repons when I put the file :
Code:
HTTP/1.1 201 Created
Last-Modified: Mon, 06 Oct 2014 21:30:10 GMT
Content-Length: 0
Etag: dcb9be2f604e5df91deb9659bed4748d
Content-Type: text/html; charset=UTF-8
X-Trans-Id: 527B5B07:EE4B_5CDEF178:01BB_543309E1_1BA6BF9:2DB7
Date: Mon, 06 Oct 2014 21:30:10 GMT
Connection: close
and when I ask object metadata I have :
Code:
HTTP/1.1 200 OK
Content-Length: 1
Accept-Ranges: bytes
Last-Modified: Mon, 06 Oct 2014 21:30:10 GMT
Etag: dcb9be2f604e5df91deb9659bed4748d
X-Timestamp: 1412631010.04616
Content-Type: image/jpeg
X-Trans-Id: 527B5B07:EE4C_5CDEF178:01BB_543309E2_173BA7F:2DB6
Date: Mon, 06 Oct 2014 21:30:10 GMT
Connection: close

In hubic.com, I see the file, but when I tried to open the file : it's corrupted

I use this header to create object :
Code:
X-Auth-Token: $token
X-Detect-Content-Type: true
Content-Length: 1

When I put other file with the API like .pdf it's ok.

Any idea ?
Thank