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:
- https://developers.google.com/my-business/reference/businessinformation/rest/v1/locations/patch?hl=en
- https://developers.google.com/my-business/content/services?hl=en
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
locationobject difference betweenlocation->categories->primaryCategory->serviceTypes(also for->additionalCategories[x]) andlocation->serviceItemssome info to clarify:location->categories->primaryCategory->serviceTypesseems to bereadonlylocation->categories->primaryCategory(->additionalCategories[x]), format is similar tocategories/gcid:wellness_centerlocation->serviceItemsare meant to be updated (patched) directlyjob_type_id:swimmingforstructuredServiceItemfreeFormServiceItem.