Site icon DataForSEO

Is it possible to filter out the Business Listings API results?

Business Listings API provides results containing information about business entities listed on Google Maps in the specified categories. To get the most relevant results and reduce the number of requests, the Business Listings Search endpoint enables you to filter out the results.

When making a request, you can set up to eight filters at once. You should set a logical operator and, or between the conditions.

Filters are associated with certain parameters from the API response. Generally, the structure of the filter includes three parts that are separated with a , symbol: filtered parameter, operator, and value.

For example, in the ["rating.value",">",3], "rating.value" is a parameter, ">" is an operator, and 3 is value.

You can find more information about how to use filters in DataForSEO APIs in this help center article.

Let’s imagine you’re doing a research on fast food restaurants in the US, but you want to exclude McDonald’s from the statistic. To achieve this you can use the following filter: ["title","not_like","McDonald's"].

Example of the request:

[
    {
        "categories": [
            "fast_food_restaurant"
        ],
        "order_by": [
            "rating.value,desc"
        ],
        "filters": [
            [
                "title",
                "not_like",
                "McDonald's"
            ],
            "and",
            [
                "address_info.country_code",
                "=",
                "US"
            ]
        ],
        "limit": 3
    }
]

In the API response you will get all fast food restaurants in the US except McDonald’s:

{
  "version": "0.1.20221214",
  "status_code": 20000,
  "status_message": "Ok.",
  "time": "0.1958 sec.",
  "cost": 0.0109,
  "tasks_count": 1,
  "tasks_error": 0,
  "tasks": [
    {
      "id": "05221814-1535-0544-0000-f9a5e9f0b97a",
      "status_code": 20000,
      "status_message": "Ok.",
      "time": "0.1663 sec.",
      "cost": 0.0109,
      "result_count": 1,
      "path": [
        "v3",
        "business_data",
        "business_listings",
        "search",
        "live"
      ],
      "data": {
        "api": "business_data",
        "function": "search",
        "categories": [
          "fast_food_restaurant"
        ],
        "order_by": [
          "rating.value,desc"
        ],
        "filters": [
          [
            "title",
            "not_like",
            "McDonald's"
          ],
          "and",
          [
            "address_info.country_code",
            "=",
            "US"
          ]
        ],
        "limit": 3
      },
      "result": [
        {
          "total_count": 116189,
          "count": 3,
          "offset": 0,
          "offset_token": "eyJDdXJyZW50T2Zmc2V0IjozLCJSZXF1ZXN0RGF0YSI6eyJuYW1lIjpudWxsLCJkZXNjcmlwdGlvbiI6bnVsbCwiY2F0ZWdvcmllcyI6WyJmYXN0X2Zvb2RfcmVzdGF1cmFudCJdLCJjb3VudHJ5X2NvZGUiOm51bGwsImNpdHkiOm51bGwsImlzX2NsYWltZWQiOm51bGwsIm9ubHlfZ29vZ2xlX2J1c2luZXNzIjpmYWxzZSwiZ2VvIjpudWxsLCJzZWFyY2hfYWZ0ZXJfdG9rZW4iOm51bGwsIm9yZGVyX2J5Ijp7Im9yZGVyX2ZpZWxkIjoicmF0aW5nLnZhbHVlIiwib3JkZXJfdHlwZSI6IkRlc2MiLCJuZXh0IjpudWxsfSwibGltaXQiOjMsIm9mZnNldCI6bnVsbH0sIlJhd1F1ZXJ5Ijp7InR5cGUiOiJhbmQiLCJsZWZ0Ijp7InR5cGUiOiJub3QiLCJzdWJxdWVyeSI6eyJmaWVsZCI6InRpdGxlIiwidHlwZSI6Imxpa2UiLCJ2YWx1ZSI6Ik1jRG9uYWxkJ3MifX0sInJpZ2h0Ijp7ImZpZWxkIjoiYWRkcmVzc19pbmZvLmNvdW50cnlfY29kZSIsInR5cGUiOiJlcSIsInZhbHVlIjoiVVMifX0sIlNlYXJjaEFmdGVyRGF0YSI6WzUuMCwiLTExNDEwODQ4NjYwMzA2MTQ4MzEiXX0=",
          "items": [
            {
              "type": "business_listing",
              "title": "Herbalife VF NUTRITION",
              "description": "Enter through the parking lot we are working on our sign, we have the green curtain in the mean time\nSUNDAYS ARE CLOSE FOR SOME REASON THE HOURS DONT WANT TO UPDATE AND SATURDAY AFTERNOON IS CLOSE",
              "category": "Fast food restaurant",
              "category_ids": [
                "fast_food_restaurant"
              ],
              "additional_categories": null,
              "cid": "13874624589003459259",
              "feature_id": "0x88541f1577f91dcb:0xc08c918d83738abb",
              "address": "6024 The Plaza unit B, Charlotte, NC 28215",
              "address_info": {
                "borough": "Shannon Park",
                "address": "6024 The Plaza unit B",
                "city": "Charlotte",
                "zip": "28215",
                "region": "North Carolina",
                "country_code": "US"
              },
              "place_id": "ChIJyx35dxUfVIgRu4pzg42RjMA",
              "phone": null,
              "url": "https://taniaramirez.goherbalife.com/Catalog/Home/Index/en-US/?ltclid=00bb923b-6512-4e0f-99a1-4df60ad1240e",
              "domain": "taniaramirez.goherbalife.com",
              "logo": "https://lh6.googleusercontent.com/-K52sYI_0WRA/AAAAAAAAAAI/AAAAAAAAAAA/eil3XkqZm7c/s44-p-k-no-ns-nd/photo.jpg",
              "main_image": "https://lh5.googleusercontent.com/p/AF1QipM_7LwudyY2DvZNuRt6x6M3LL5QVbOeKsZy7-Jf=w408-h544-k-no",
              "total_photos": 21,
              "snippet": "6024 The Plaza unit B, Charlotte, NC 28215",
              "latitude": 35.2478544,
              "longitude": -80.7538695,
              "is_claimed": true,
              "attributes": {
                "available_attributes": {
                  "service_options": [
                    "has_curbside_pickup",
                    "has_takeout",
                    "serves_dine_in"
                  ],
                  "popular_for": [
                    "serves_lunch_popular",
                    "suitable_for_solo_dining"
                  ],
                  "accessibility": [
                    "has_wheelchair_accessible_parking"
                  ],
                  "offerings": [
                    "quick_bite"
                  ],
                  "dining_options": [
                    "serves_lunch"
                  ],
                  "amenities": [
                    "welcomes_children"
                  ],
                  "atmosphere": [
                    "feels_casual"
                  ]
                },
                "unavailable_attributes": {
                  "service_options": [
                    "has_delivery"
                  ]
                }
              },
              "place_topics": null,
              "rating": {
                "rating_type": "Max5",
                "value": 5,
                "votes_count": 4,
                "rating_max": null
              },
              "rating_distribution": {
                "1": 0,
                "2": 0,
                "3": 0,
                "4": 0,
                "5": 4
              },
              "people_also_search": [
                {
                  "cid": "4607232055286866047",
                  "feature_id": "0x0:0x3ff02d24e52aa07f",
                  "title": "Herbalife Club De Nutrición Vida Feliz",
                  "rating": {
                    "rating_type": "Max5",
                    "value": 3.3,
                    "votes_count": 8,
                    "rating_max": null
                  }
                },
                {
                  "cid": "5279715889507914270",
                  "feature_id": "0x0:0x494551a0dd1ad21e",
                  "title": "Vida Saludable",
                  "rating": {
                    "rating_type": "Max5",
                    "value": 5,
                    "votes_count": 6,
                    "rating_max": null
                  }
                },
                {
                  "cid": "86423974198085590",
                  "feature_id": "0x0:0x1330a258a2787d6",
                  "title": "Vida Feliz",
                  "rating": {
                    "rating_type": "Max5",
                    "value": null,
                    "votes_count": null,
                    "rating_max": null
                  }
                }
              ],
              "work_time": {
                "work_hours": {
                  "timetable": {
                    "sunday": null,
                    "monday": [
                      {
                        "open": {
                          "hour": 7,
                          "minute": 0
                        },
                        "close": {
                          "hour": 12,
                          "minute": 0
                        }
                      },
                      {
                        "open": {
                          "hour": 18,
                          "minute": 0
                        },
                        "close": {
                          "hour": 20,
                          "minute": 0
                        }
                      }
                    ],
                    "tuesday": [
                      {
                        "open": {
                          "hour": 7,
                          "minute": 0
                        },
                        "close": {
                          "hour": 12,
                          "minute": 0
                        }
                      },
                      {
                        "open": {
                          "hour": 18,
                          "minute": 0
                        },
                        "close": {
                          "hour": 20,
                          "minute": 0
                        }
                      }
                    ],
                    "wednesday": [
                      {
                        "open": {
                          "hour": 7,
                          "minute": 0
                        },
                        "close": {
                          "hour": 12,
                          "minute": 0
                        }
                      },
                      {
                        "open": {
                          "hour": 18,
                          "minute": 0
                        },
                        "close": {
                          "hour": 20,
                          "minute": 0
                        }
                      }
                    ],
                    "thursday": [
                      {
                        "open": {
                          "hour": 7,
                          "minute": 0
                        },
                        "close": {
                          "hour": 12,
                          "minute": 0
                        }
                      },
                      {
                        "open": {
                          "hour": 18,
                          "minute": 0
                        },
                        "close": {
                          "hour": 20,
                          "minute": 0
                        }
                      }
                    ],
                    "friday": [
                      {
                        "open": {
                          "hour": 7,
                          "minute": 0
                        },
                        "close": {
                          "hour": 12,
                          "minute": 0
                        }
                      },
                      {
                        "open": {
                          "hour": 18,
                          "minute": 0
                        },
                        "close": {
                          "hour": 20,
                          "minute": 0
                        }
                      }
                    ],
                    "saturday": [
                      {
                        "open": {
                          "hour": 20,
                          "minute": 0
                        },
                        "close": {
                          "hour": 0,
                          "minute": 0
                        }
                      }
                    ]
                  },
                  "current_status": "close"
                }
              },
              "popular_times": null,
              "local_business_links": [
                {
                  "type": "menu",
                  "title": "apps.apple.com",
                  "url": "https://apps.apple.com/us/app/hn-myclub/id1455562228"
                }
              ],
              "contact_info": null,
              "check_url": "https://www.google.com/maps?cid=13874624589003459259&hl=en&gl=US",
              "last_updated_time": "2023-03-23 09:22:36 +00:00"
            }
          ]
        }
      ]
    }
  ]
}

Exit mobile version