I got a verified location in google mybusiness but when i use the API, it returns an empty array [] I am using this endpoint. I am using laravel 6 and curl library for HTTP requests in this project.
'https://mybusiness.googleapis.com/v4/accounts/117177930435384486747/locations'
Here is my whole controller function
public function getLocations(Request $request){
$url = 'https://mybusiness.googleapis.com/v4/accounts/'.$request->account_id.'/locations:batchGet';
$headers = array(
'Content-Type: application/json',
'Authorization: Bearer '.$request->bearer_token
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close ($ch);
return response()->json(json_decode($result,true));
}
What did I miss? I already got the account info by using this endpoint
https://mybusiness.googleapis.com/v4/accounts and it got me a response of
{
"accounts": [
{
"name": "accounts/117177930435384486747",
"accountName": "Michael koh",
"type": "PERSONAL",
"state": {
"status": "UNVERIFIED",
"vettedStatus": "NOT_VETTED"
},
"profilePhotoUrl": "//lh6.googleusercontent.com/-Jv5Xr7SXjuE/AAAAAAAAAAI/AAAAAAAAAAA/QryQ_2-Mjqo/s132-mo/photo.jpg"
}
]
}
In the response, it says not verified. But when i go to google mybusiness UI. I got this when i click manage location. Seems weird because it shows verified.
PS:
I tried getting the location by calling this endpoint GET https://mybusiness.googleapis.com/v4/{parent=accounts/*}/locations but I got an empty array
