I call this api using php to get the specific category. And it successfully get the category in english language.
$queryParams = array(
'regionCode' => 'US',
'languageCode' => 'en',
'view' => 'BASIC'
);
if(!empty($filter)) {
$queryParams['filter'] = 'displayName=Software company';
}
$curl = curl_init('https://mybusinessbusinessinformation.googleapis.com/v1/categories/?'.http_build_query($queryParams));
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
'Authorization: Bearer ' . $myAccessToken,
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($curl);
curl_close($curl);
$categories = json_decode($response);
Now, I want to translate that or get the equivalent category in japanese. But it has no return. Because the word 'Software company' is not on the category list if the language code is japanese.
$queryParams = array(
'regionCode' => 'JP',
'languageCode' => 'ja',
'view' => 'BASIC'
);
if(!empty($filter)) {
$queryParams['filter'] = 'displayName=Software company';
}
$curl = curl_init('https://mybusinessbusinessinformation.googleapis.com/v1/categories/?'.http_build_query($queryParams));
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
'Authorization: Bearer ' . $myAccessToken,
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($curl);
curl_close($curl);
$categories = json_decode($response);
How can I be able to get the japanese category name of 'Software company' using Google My Business API? Is there any way? According to their docs, we can only filter by displayName.
CodePudding user response:
You'll have to do the filtering yourself - so request all categories and then find the correct display name in Japanese by looking for the respective gcid.