Google Attributes With The API

Learn how to manage Google Attributes for locations with the API

Last updated on September 12th, 2023

Google Business Profile (GBP) Attributes can be added and edited to a location via the User Interface in the user portal. A location needs to have specified category for the Attributes to be editable via a DropDown List. When managing locations with the API, managing GMB Attributes is possible. 

*Note that the Attributes are directly linked to the Primary Category of the selected location.

This can be achieved in three steps.

Retrieving Available Categories

The full list of available Uberall Categories can be retrieved with the following API call. Uberall categories are linked to GBP categories and other directories categories. This list of categories can be further refined by using parameters outlined in the full API call documentation. The language parameter is required to make a successful API call.

GET https://uberall.com/api/categories?language=en

parameters = {
                    "language": $YOUR_PREFERRED_LANGUAGE
               }

headers = {
                "privateKey": $API_KEY
            }

reponse = {
                {
                    "status": "SUCCESS",
                    "response": {
                        "results": [
                            {
                                "id": 2,
                                "name": "Towing Service",
                                "fullName": "Automotive and Transportation > Transportation Company and Services > Towing Service",
                                "selectable": true,
                                "parent": 4126
                            },
                            {
                                "id": 3,
                                "name": "Auto Glass Shop",
                                "fullName": "Automotive and Transportation > Garage, Parts and Accessories > Auto Glass Shop",
                                "selectable": true,
                                "parent": 4127
                            },
              }

Retrieving Available Attributes

Once the category IDs have successfully retrieved with the API, these can be used to get the list of available Google Attributes per category. The country parameter is required to make a successful API call. Further information can be found in the full API call documentation.

GET https://uberall.com/API/categories/$CATEGORY_ID/attributes?language=en&country=CA

parameters = {
                    "country": $COUNTRY
               }

headers = {
                "privateKey": $API_KEY
            }

response = {
                "status": "SUCCESS",
                "response": {
                    "Attributes": [
                        {
                            "externalId": "url_appointment",
                            "displayName": "Appointment links",
                            "valueType": "URL",
                            "valueMetadata": null
                        },
                        {
                            "externalId": "is_owned_by_women",
                            "displayName": "Identifies as women-led",
                            "valueType": "BOOL",
                            "valueMetadata": [
                                {
                                    "value": "true",
                                    "displayName": "Identifies as women-led"
                                }
                            ]
                        }
                    ]
                }
            }

Assigning Attributes to a Location

Attributes can be added to an existing or a new location. The Attributes must be available for the Primary Category associated to the location. Attributes must be defined in the Attributes element part of the location object as part of an attributeWrapper object. The full attributeWrapper object is defined here.

Delete

Warning

If the attribute you are trying to update is related to a payment method, you also need to update the paymentOptions field at the same time. If only one of the fields is updated, the update will not be applied.


Considering the attribute data retrieved in the previous examples, our location with Primary Category Towing Service (ID 2) can have both the url_appointment and is_owned_by_women Attributes. To associate these Attributes, the Attributes element needs to be configured as follows:

"attributes": [
                {
                    "displayName": "Appointment links",
                    "externalId": "url_appointment",
                    "value": "https://yourURLhere.com",
                    "valueType": "URL",
                },
                {
                    "displayName": "Identifies as women-led",
                    "externalId": "is_owned_by_women",
                    "value": "true",
                    "valueType": "BOOL"
                }
            ]

Info

Refer to the API documentation on how to create and update locations to integrate the Attributes into the API flow.


Was this article helpful?

Save as PDF