Mtoypc
Mtoypc

Reputation: 494

Uploading a file with google cloud API with a PUT at root of server?

I have a server using the google Drive API. I tried with a curl PUT request to upload a simple file (test.txt) at http://myserver/test.txt. As you can see, I did the PUT request at the root of my server. The response I get is the following:

HTTP/1.1 200 OK X-GUploader-UploadID: AEnB2UqANa4Bj6ilL7z5HZH0wlQi_ufxDiHPtb2zq1Gzcx7IxAEcOt-AOlWsbX1q_lsZUwWt_hyKOA3weAeVpQvPQTwbQhLhIA ETag: "6e809cbda0732ac4845916a59016f954" x-goog-generation: 1548877817413782 x-goog-metageneration: 1 x-goog-hash: crc32c=jwfJwA== x-goog-hash: md5=boCcvaBzKsSEWRalkBb5VA== x-goog-stored-content-length: 6 x-goog-stored-content-encoding: identity Content-Type: text/html; charset=UTF-8 Accept-Ranges: bytes Via: 1.1 varnish Content-Length: 0 Accept-Ranges: bytes Date: Wed, 30 Jan 2019 19:50:17 GMT Via: 1.1 varnish Connection: close X-Served-By: cache-bwi5139-BWI, cache-cdg20732-CDG X-Cache: MISS, MISS X-Cache-Hits: 0, 0 X-Timer: S1548877817.232336,VS0,VE241 Vary: Origin Access-Control-Allow-Methods: POST,PUT,PATCH,GET,DELETE,OPTIONS Access-Control-Allow-Headers: Cache-Control,X-Requested-With,Authorization,Content-Type,Location,Range Access-Control-Allow-Credentials: true Access-Control-Max-Age: 300

I know you're not supposed to use the API that way. I did that for testing purposes. I understand every headers returned but can't figure out if my file has been uploaded because I don't have enough knowledge of this API. My question is very simple : Just by looking at the response, can you tell me if my file has been uploaded ? If yes can I retrieve it and how ?

Upvotes: 0

Views: 57

Answers (1)

Doug Stevenson
Doug Stevenson

Reputation: 317352

The HTTP status code traditionally indicates, for any given request, if it was successful. The status code in the response is always on the first line:

HTTP/1.1 200 OK

200 type status codes mean success. You should take some time to familiarize yourself with HTTP status codes if you intend to work with HTTP APIs.

Upvotes: 1

Related Questions