上传成功获取照片Id但是无法从该照片Id获取上传的图片
Upload succes to get the photoId but can not get the uploaded image from this photoId
我按照说明上传照片link。
我在 call.
之后得到了 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 时。我检查响应细节。它不会在上传照片响应的元数据中显示 "* upload completely sent off: 632 out of 632 bytes" 之类的消息。但是不知道怎么解决
将照片字节上传到上传 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
您可以尝试在调用 Uploading a photo (if you are using curl). Also you can also check the response code, if it is 200 then its ok. Lastly, make sure that you are uploading a proper 360 image. Follow this comment 的第 2 步时在请求末尾添加 --verbose
,其中讨论了光球元数据和 exiftool
终于找到问题的根源了。我的照片上缺少一些 XMP 元数据。 Google 不检查和响应错误的 XMP 元照片的错误。因此,确保您的照片具有正确的 XMP 元数据是修复它的唯一方法。
我按照说明上传照片link。
我在 call.
之后得到了 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 时。我检查响应细节。它不会在上传照片响应的元数据中显示 "* upload completely sent off: 632 out of 632 bytes" 之类的消息。但是不知道怎么解决
将照片字节上传到上传 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
您可以尝试在调用 Uploading a photo (if you are using curl). Also you can also check the response code, if it is 200 then its ok. Lastly, make sure that you are uploading a proper 360 image. Follow this comment 的第 2 步时在请求末尾添加 --verbose
,其中讨论了光球元数据和 exiftool
终于找到问题的根源了。我的照片上缺少一些 XMP 元数据。 Google 不检查和响应错误的 XMP 元照片的错误。因此,确保您的照片具有正确的 XMP 元数据是修复它的唯一方法。