Home » Php » php – Adding serviceTypes in location services using GMB API giving error

php – Adding serviceTypes in location services using GMB API giving error

Posted by: admin February 25, 2020 Leave a comment

Questions:

I have one verified GMB profile and I am trying to add services using Google My Business API

My PATCH Request URL :

https://mybusiness.googleapis.com/v4/accounts/ACCOUNT_ID/locations/LOCATION_ID?validateOnly=False&updateMask=primaryCategory,serviceTypes

My Request JSON data:

1)

{
    "primary_category": {
        "displayName": "IT support and services",
        "categoryId": "gcid:computer_support_and_services",
        "service_types": [
          {
            "service_type_id": "job_type_id:it_consulting",
            "display_name": "It consulting"
          }
        ]
      }
}

2)

{
    "primaryCategory": {
        "displayName": "IT support and services",
        "categoryId": "gcid:computer_support_and_services",
        "serviceTypes": [
          {
            "serviceTypeId": "job_type_id:installation",
            "displayName": "Installation"
          },
          {
            "serviceTypeId": "job_type_id:it_consulting",
            "displayName": "It consulting"
          }
        ]
      }
}

GMB Error Response :

{
  "error": {
    "code": 400,
    "message": "Request contains an invalid argument.",
    "status": "INVALID_ARGUMENT",
    "details": [
      {
        "@type": "type.googleapis.com/google.mybusiness.v4.ValidationError",
        "errorDetails": [
          {
            "code": 3,
            "message": "field mask paths: \"primary_category\"\npaths: \"service_types\"\n contains invalid fields"
          }
        ]
      }
    ]
  }

Any one know, How to solve the issue?

How to&Answers: