I'm trying to upload spherical images on street view using Publish Api. Upload of image data and place association works well, but whenever i try to upload heading and gps position data to the image server responds "OK" but then no heading nor position were associated to the image.
Here is the php code i use for the last step of info upload, i really don't know where i am wrong.
$data['uploadReference']['uploadUrl']=$upload_url;
$data['pose']['heading']=$heading_north;
$data['pose']['latLngPair']=$latLngPair;
$data['captureTime']['seconds']=time();
$data['places']['placeId']=$placeid;
$data_string = json_encode($data);
$ch = curl_init('https://streetviewpublish.googleapis.com/v1/photo?key='.$_GOOGLE_API['api_key']);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'authorization: Bearer '.$_GOOGLE_API['access_token'],
'Content-Type: application/json',
'Content-Length: ' . strlen($data_string))
);
$result = curl_exec($ch);
curl_close ($ch);
EDIT:
I've implemented the second step as suggested but nothing changes.. Curl response still doesn't contains any error..
$ch = curl_init('https://streetviewpublish.googleapis.com/v1/photo/'.$photo_id.'?key='.$_GOOGLE_API['api_key'].'&updateMask=pose.heading');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'authorization: Bearer '.$_GOOGLE_API['access_token'],
'Content-Type: application/json',
'Content-Length: ' . strlen($data_string))
);
$json_response=curl_exec($ch);
curl_close ($ch);
echo $json_response;
EDIT2: this procedure works but google apis are slow and edited data will show up in minutes..
EDIT3 (SOLVED): GET photos (list) has some chache issue. to get the correct value just updated you need to request GET photo (single) to force an effective cache update.