phpjsoncurlgoogle-streetview-publish

What would be the correct JSON argument to update roll and connections in street view publish API


I am trying to update pose.roll and connections along with other UpdateMasks but only updates heading and pitch, pose.roll remain NULL.

Here is php code

<?php
$ch_a = curl_init();      
curl_setopt($ch_a, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch_a, CURLOPT_HTTPHEADER, array('Authorization: Bearer '.$_SESSION['access_token'], 'Content-Type: application/json'));
curl_setopt($ch_a, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch_a, CURLOPT_URL, 'https://streetviewpublish.googleapis.com/v1/photo/'.$photoId.'?key='.$config['apikey'].'&updateMask=pose.heading,pose.pitch,pose.roll,connections');
curl_setopt($ch_a, CURLOPT_POSTFIELDS, '{"pose":{"heading": 145.9086485977801, "pitch":3.219209274200196, "roll":"0"}}');
$url = curl_exec($ch_a);
curl_close($ch_a);
echo $url;
?>

Solution

  • I think this is an expected behavior.

    I've tried this sample request using the Try It! in the documentation.

    {
      "pose": {
        "roll": 0,
        "latLngPair": {
          "longitude": 118.04944440000001,
          "latitude": 12.5343694
        },
        "heading": 90,
        "pitch": 5.0999984741210938
      }
    }
    

    Then I received this 200 response:

    {
      "photoId": {
        "id": "ID"
      },
      "pose": {
        "latLngPair": {
          "latitude": 12.5343694,
          "longitude": 118.04944440000001
        },
        "heading": 90,
        "pitch": 5.0999984741210938
      }
    }
    

    If you updated roll to 0, then the value will be null. When the value of roll is >0, it will appear in the response. Example:

    {
      "photoId": {
        "id": "ID"
      },
      "pose": {
        "latLngPair": {
          "latitude": 12.5343694,
          "longitude": 118.04944440000001
        },
        "heading": 90,
        "pitch": 5.0999984741210938,
        "roll": 5
      }
    }