Google街景发布返回“照片没有上传参考”。在statusCode 200之后

时间:2017-09-26 22:23:25

标签: node.js google-streetview-publish

我正在使用NodeJS上传全景图像 当我在Google documentation中通知#2时,我收到以下回复:

请求

{
  "url": "UPLOAD_URL",
  "body": "/PATH_TO_PANO/pano.jpg",
  "method": "POST",
  "headers": {
    "Authorization": "Bearer YOUR_ACCESS_TOKEN",
    "Content-Type": "image/jpeg"
  }
}

响应

{
  "statusCode": 200,
  "body": "",
  "headers": {
    "x-guploader-uploadid": "AEnB2UoJt4gvmmU6gXZvWDRu4b0DUCeT5vuPKLGcZqM4Tzo9HssCLoloTgAACRmxmP0U5DDYvHXpThCjRslW80bEKLZjUjJB3QNZ5w-    j0jd8jdtVnH8X0c",
    "content-length": "0",
    "date": "Tue, 26 Sep 2017 21:05:17 GMT",
    "server": "UploadServer",
    "content-type": "text/html; charset=UTF-8",
    "alt-svc": "quic=\":443\"; ma=2592000; v=\"39,38,37,35\"",
    "connection": "close"
  },
  "request": {
    "uri": {
      "protocol": "https:",
      "slashes": true,
      "auth": null,
      "host": "streetviewpublish.googleapis.com",
      "port": 443,
      "hostname": "streetviewpublish.googleapis.com",
      "hash": null,
      "search": null,
      "query": null,
      "pathname": "/media/user/USER_ID/photo/PHOTO_ID",
      "path": "/media/user/USER_ID/photo/PHOTO_ID",
      "href": "https://streetviewpublish.googleapis.com/media/user/USER_ID/photo/PHOTO_ID"
    },
    "method": "POST",
    "headers": {
      "Authorization": "Bearer YOUR_ACCESS_TOKEN",
      "Content-Type": "image/jpeg",
      "content-length": 45
    }
  }
}


但是当我上传照片的元数据时,我收到以下消息:

请求

{
  "url": "https://streetviewpublish.googleapis.com/v1/photo?key=YOUR_API_KEY",
  "method": "POST",
  "headers": {
    "Authorization": "Bearer YOUR_ACCESS_TOKEN",
    "Content-Type": "application/json",
    "Content-Length": 9385487
  },
  "data": {
    "uploadReference": {
      "uploadUrl": "UPLOAD_URL"
    },
    "pose": {
      "heading": 110,
      "latLngPair": {
        "latitude": -29.937386,
        "longitude": -60.996952
      }
    },
    "captureTime": {
      "seconds": 1506448064836
    }
  }
}

响应

{
  "error": {
    "code": 400,
    "message": "Photo does not have upload reference.",
    "status": "INVALID_ARGUMENT"
  }
}

基于自己并找到问题的参考文献并不多。出于这个原因,我希望得到一些可能经历过类似事情的人的帮助。

1 个答案:

答案 0 :(得分:0)

我已经复制了你的问题。当我没有在请求中指定UPLOAD_URL时,我遇到了此错误。

{
  "error": {
    "code": 400,
    "message": "Photo upload url does not match required format.",
    "status": "INVALID_ARGUMENT",
    "details": [
      {
        ...
      }
    ]
  }
}

确保您在请求中添加了UPLOAD_URL。有关详细信息,请查看此documentation