2017-11-07 18 views
0

Google Cloud Storage JSON API를 사용하여 재개 가능한 세션 URI를 생성하려고합니다. docs 다음 나는 밖으로 필요한 인수 그러나 Google Cloud Storage로 업로드 할 수있는 업로드 세션 URI 요청

curl \ 
-X POST \ 
-H "Content-Length: 1000000" \ 
-d "uploadType=resumable&name=cat.jpg" \ 
https://www.googleapis.com/upload/storage/v1/b/my-bucket/o 

에만이 시간을 만족하기 위해 함께 다음 curl 명령을 넣어 가지고 있고 서버가 응답하지 않습니다. Content-Type은 파일 메타 데이터를 보내는 경우에만 필요합니다. 나는 또한 메타 데이터와 관련 데이터를 추가하려고 시도했으나 실패했다.

문서의 예제 요청에는 단계에 언급되지 않은 Authorization: Bearer [YOUR_AUTH_TOKEN] 헤더가 있습니다. 또한 app의 api 키를 사용하여 이것을 추가하려고 시도했으나 시간이 초과되었습니다.

버킷의 ACL이 쓰기 가능한 모든 사용자로 설정되었습니다. CORS가 구성되지 않았습니다.

어디서 잘못 알았습니까?

컬 자세한 출력 그래서 나는이 지금 작업 한

* Hostname was NOT found in DNS cache 
* Trying 216.58.208.138... 
* Connected to www.googleapis.com (216.58.208.138) port 443 (#0) 
* successfully set certificate verify locations: 
* CAfile: none 
    CApath: /etc/ssl/certs 
* SSLv3, TLS handshake, Client hello (1): 
* SSLv3, TLS handshake, Server hello (2): 
* SSLv3, TLS handshake, CERT (11): 
* SSLv3, TLS handshake, Server key exchange (12): 
* SSLv3, TLS handshake, Server finished (14): 
* SSLv3, TLS handshake, Client key exchange (16): 
* SSLv3, TLS change cipher, Client hello (1): 
* SSLv3, TLS handshake, Finished (20): 
* SSLv3, TLS change cipher, Client hello (1): 
* SSLv3, TLS handshake, Finished (20): 
* SSL connection using ECDHE-ECDSA-AES128-GCM-SHA256 
* Server certificate: 
* subject: C=US; ST=California; L=Mountain View; O=Google Inc; CN=*.googleapis.com 
* start date: 2017-10-24 08:38:00 GMT 
* expire date: 2017-12-29 00:00:00 GMT 
* subjectAltName: www.googleapis.com matched 
* issuer: C=US; O=Google Inc; CN=Google Internet Authority G2 
* SSL certificate verify ok. 
> POST /upload/storage/v1/b/aits-resumables-test/o HTTP/1.1 
> User-Agent: curl/7.35.0 
> Host: www.googleapis.com 
> Accept: */* 
> Content-Length: 1000000 
> Content-Type: application/json; charset=UTF-8 
> 
* upload completely sent off: 33 out of 33 bytes 

답변

1

입니다. JSON 본문에 객체 이름을 추가 한 다음 URL에 uploadType=resumable을 직접 추가하여 다음과 같이 표시했습니다.

curl \ 
-X POST \ 
-H "Content-Type: application/json; charset=UTF-8" \ 
-H "X-Upload-Content-Type: image/jpeg" \ 
-H "X-Upload-Content-Length: 2000000" \ 
-d '{"name": "cat.jpg"}' \ 
https://www.googleapis.com/upload/storage/v1/b/my-bucket/o?uploadType=resumable