I am trying to patch a location with some new service types and I am using validateOnly
set to true
.
But the response I am getting is: "Provided service type ID is not among those supported by the business's categories."
I have been testing with different serviceId
types such as:
gcid:parking_garage
gcid:parking_lot
gcid:parking_lot_for_bicycles
gcid:parking_lot_for_motorcycle
but to no avail.
Full error message is:
{
"error": {
"code": 400,
"message": "Request contains an invalid argument.",
"status": "INVALID_ARGUMENT",
"details": [
{
"@type": "type.googleapis.com/google.rpc.BadRequest",
"fieldViolations": [
{
"field": "service_items[0].structured_service_item.service_type_id",
"description": "Provided service type ID is not among those supported by the business's categories."
}
]
}
]
}
}
I am using the official PHP API client + service APIs as provided here: https://github.com/googleapis/google-api-php-client-services
Official API reference:
Any tips?
You misunderstood that documentation. The endpoint to get the categories will show you the available serviceIds per category if you request the FULL CategoryView (https://developers.google.com/my-business/reference/businessinformation/rest/v1/CategoryView).
To inspect available services for the given categories, a less cumbersome approach is to add them to a test location via the GBP UI and then execute a location get request and readMask set to serviceItems to inspect what the serviceItems array looks like for that location.
Added by the OP:
For anyone wondering about location
object difference between location->categories->primaryCategory->serviceTypes
(also for ->additionalCategories[x]
) and location->serviceItems
some info to clarify:
location->categories->primaryCategory->serviceTypes
seems to be readonly
location->categories->primaryCategory
(->additionalCategories[x]
), format is similar to categories/gcid:wellness_center
location->serviceItems
are meant to be updated (patched) directly
job_type_id:swimming
for structuredServiceItem
freeFormServiceItem
.