我按照说明上传照片链接。通话后
我得到photoId。
但我无法通过电话获取图像:
curl --request GET \
--url 'streetviewpublish.googleapis.com/v1/photos?key=YOUR_API_KEY' \
--header 'authorization: Bearer YOUR_ACCESS_TOKEN'
或致电:
curl --request GET \
--url 'streetviewpublish.googleapis.com/v1/photo/PHOTO_ID?key=YOUR_API_KEY' \
--header 'authorization: Bearer YOUR_ACCESS_TOKEN'
我看到教程说,如果你得到了photoId意味着上传成功。如何确保我的照片上传成功?
更新:根据 Mr.Rebot 的意见,我添加 --verbose 以查看响应详细信息。但我在响应中找不到任何错误。我猜根本原因可能是在将照片字节上传到上传 URL 时发生。我检查了响应详细信息。它不会在上传照片响应的元数据中显示类似“* 上传完全发送:632 个字节中的 632 个”的消息。但我不知道如何解决它。
将照片字节上传到上传 URL 响应如下所示:
* Trying 216.58.200.42...
* TCP_NODELAY set
* Connected to streetviewpublish.googleapis.com (216.58.200.42) port 443 (#0)
* TLS 1.2 connection using TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
* Server certificate: *.googleapis.com
* Server certificate: Google Internet Authority G2
* Server certificate: GeoTrust Global CA
> POST /media/user/114009162009986408485/photo/3946916238102603576 HTTP/1.1
> Host: streetviewpublish.googleapis.com
> User-Agent: curl/7.51.0
> Accept: */*
> Authorization: Bearer ya29.GlvKBHgR75-11mkyh-7Yy0YHSnY2at7ceBKkmcz6Kmt0axDqRD7iTfqp8_nfBZgQrU25V77WKk3gCBZ6w6ce9TBz26mLusLzZqjX7qUGi306Z_PhkPTSqfXZwte2
> Content-Length: 2684889
> Expect: 100-continue
>
< HTTP/1.1 100 Continue
* We are completely uploaded and fine
< HTTP/1.1 200 OK
< X-GUploader-UploadID: AEnB2Uq1RvuwmbMZizf-MLlPcB8hJC2NBgpaEMR-K_AomU7nIQ7DTkv94Ekij3_zPNyPK7tTypkYywHualC_EnvzCoM2OuosuckDFF8OtoLT97CecFwnYk4
< Content-Length: 0
< Date: Mon, 18 Sep 2017 06:01:25 GMT
< Server: UploadServer
< Content-Type: text/html; charset=UTF-8
< Alt-Svc: quic=":443"; ma=2592000; v="39,38,37,35"
<
* Curl_http_done: called premature == 0
* Connection #0 to host streetviewpublish.googleapis.com left intact
上传照片响应的元数据如下所示:
Note: Unnecessary use of -X or --request, POST is already inferred.
* Trying 216.58.200.234...
* TCP_NODELAY set
* Connected to streetviewpublish.googleapis.com (216.58.200.234) port 443 (#0)
* TLS 1.2 connection using TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
* Server certificate: *.googleapis.com
* Server certificate: Google Internet Authority G2
* Server certificate: GeoTrust Global CA
> POST /v1/photo?key=AIzaSyBINbdfV0eqE2fdc_ywJzL-oCa7fs_qNrQ HTTP/1.1
> Host: streetviewpublish.googleapis.com
> User-Agent: curl/7.51.0
> Accept: */*
> Authorization: Bearer ya29.GlvKBHgR75-11mkyh-7Yy0YHSnY2at7ceBKkmcz6Kmt0axDqRD7iTfqp8_nfBZgQrU25V77WKk3gCBZ6w6ce9TBz26mLusLzZqjX7qUGi306Z_PhkPTSqfXZwte2
> Content-Type: application/json
> Content-Length: 632
>
* upload completely sent off: 632 out of 632 bytes
< HTTP/1.1 200 OK
< Content-Type: application/json; charset=UTF-8
< Vary: X-Origin
< Vary: Referer
< Date: Mon, 18 Sep 2017 05:47:24 GMT
< Server: ESF
< Cache-Control: private
< X-XSS-Protection: 1; mode=block
< X-Frame-Options: SAMEORIGIN
< X-Content-Type-Options: nosniff
< Alt-Svc: quic=":443"; ma=2592000; v="39,38,37,35"
< Accept-Ranges: none
< Vary: Origin,Accept-Encoding
< Transfer-Encoding: chunked
<
{
"photoId": {
"id": "CAoSLEFGMVFpcE9Zc0I4U25pWkcwaUFRWk11ZXZ3d3VzVkRaUTFxZlIyWks5VnE2"
}
}
* Curl_http_done: called premature == 0
* Connection #0 to host streetviewpublish.googleapis.com left intact