2017-09-26 36 views
0

我使用NodeJS上傳全景圖像。
當我做#2告知在Google documentation,我得到以下回報:谷歌街景發佈返回的「照片沒有上傳參考。」 after statusCode 200

請求

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

有沒有立足自己,發現問題很多引用。出於這個原因,我希望可能經歷過類似事情的人的幫助。

回答

0

我已複製您的問題。我在請求中未指定UPLOAD_URL時遇到此錯誤。

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

確保您在請求中添加了UPLOAD_URL。點擊這裏documentation瞭解更多信息。

+0

@abelita您是否可以輸入您的請求,因爲即使沒有標籤_'uploadReference'也無法重現相同的錯誤:{'uploadUrl':'UPLOAD_URL'_。 – Dkauf

+0

我在這個鏈接中使用了示例請求:['上傳照片'](https://developers.google.com/streetview/publish/first-app#sample-requests)。 – abielita