Google Street View Publish return's "Photo does not have upload reference." after statusCode 200

219 Views Asked by At

I'm using NodeJS to upload panoramic images.
When I make #2 informed in the Google documentation, I get the following return:

Request

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

Response

{
  "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
    }
  }
}


But when I upload the metadata of the photo, I get the following message:

Request

{
  "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
    }
  }
}

Response

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

There are not many references to basing myself and finding the problem. For that reason I would like the help of someone who may have gone through something similar.

1

There are 1 best solutions below

2
abielita On

I have replicated your issue. I've encountered this error when I didn't specify the UPLOAD_URL in the request.

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

Make sure that you have added the UPLOAD_URL in the request. Check this documentation for more information.