0

我正在使用 NodeJS 上传全景图像。
当我在Google 文档中通知 #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"
  }
}

没有多少关于立足自己并找到问题的参考资料。出于这个原因,我希望得到可能经历过类似事情的人的帮助。

4

1 回答 1

0

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

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

确保您已UPLOAD_URL在请求中添加 。查看此文档以获取更多信息。

于 2017-09-28T13:06:53.103 回答