NAVNavbar
Logo
cURL php NodeJS Python cSharp

Live Business Listings Categories Aggregation Tasks

‌‌
Business Listings Categories Aggregation endpoint provides results containing information about groups of related categories along with the number of entities in each category. The provided results are specific to the specified parameters.

Instead of ‘login’ and ‘password’ use your credentials from https://app.dataforseo.com/api-access

<?php
// You can download this file from here https://cdn.dataforseo.com/v3/examples/php/php_RestClient.zip?202197
require('RestClient.php');
$api_url = 'https://api.dataforseo.com/';
// Instead of 'login' and 'password' use your credentials from https://app.dataforseo.com/api-access
$client = new RestClient($api_url, null, 'login', 'password');
$post_array = array();
// simple way to get a result
$post_array[] = array(
   "categories" => ["pizza_restaurant"],
   "description" => "pizza",
   "title" => "pizza",
   "is_claimed" => true,
   "location_coordinate" => "53.476225,-2.243572,10",
   "initial_dataset_filters" => [
      [ "rating.value",">",3 ]
   ],
   "internal_list_limit" => 10,
   "limit" => 3
);
try {
   // POST /v3/business_data/business_listings/categories_aggregation/live
   // the full list of possible parameters is available in documentation
   $result = $client->post('/v3/business_data/business_listings/categories_aggregation/live', $post_array);
   print_r($result);
   // do something with post result
} catch (RestClientException $e) {
   echo "n";
   print "HTTP code: {$e->getHttpCode()}n";
   print "Error code: {$e->getCode()}n";
   print "Message: {$e->getMessage()}n";
   print  $e->getTraceAsString();
   echo "n";
}
$client = null;
?>

The above command returns JSON structured like this:

{
  "version": "0.1.20221214",
  "status_code": 20000,
  "status_message": "Ok.",
  "time": "0.3505 sec.",
  "cost": 0.0109,
  "tasks_count": 1,
  "tasks_error": 0,
  "tasks": [
    {
      "id": "04301510-1535-0545-0000-92269c6091b9",
      "status_code": 20000,
      "status_message": "Ok.",
      "time": "0.2798 sec.",
      "cost": 0.0109,
      "result_count": 1,
      "path": [
        "v3",
        "business_data",
        "business_listings",
        "categories_aggregation",
        "live"
      ],
      "data": {
        "api": "business_data",
        "function": "categories_aggregation",
        "categories": [
          "pizza_restaurant"
        ],
        "description": "pizza",
        "title": "pizza",
        "is_claimed": true,
        "location_coordinate": "53.476225,-2.243572,10",
        "initial_dataset_filters": [
          [
            "rating.value",
            ">",
            3
          ]
        ],
        "limit": 3
      },
      "result": [
        {
          "total_count": 26,
          "count": 3,
          "offset": null,
          "offset_token": null,
          "items": [
            {
              "type": "business_category",
              "categoiries": [
                "pizza_restaurant"
              ],
              "aggregation": {
                "top_categories": {
                  "pizza_restaurant": 32,
                  "pizzatakeaway": 14,
                  "restaurant": 12,
                  "pizza_delivery_service": 11,
                  "delivery_service": 7,
                  "italian_restaurant": 7,
                  "neapolitan_restaurant": 6,
                  "fast_food_restaurant": 4,
                  "meal_takeaway": 3,
                  "vegan_restaurant": 3
                },
                "top_countries": {
                  "GB": 32
                },
                "websites_count": 18,
                "count": 32,
                "top_attributes": {
                  "has_delivery": 32,
                  "has_takeout": 32,
                  "feels_casual": 28,
                  "pay_debit_card": 26,
                  "pay_mobile_nfc": 23,
                  "has_no_contact_delivery": 20,
                  "serves_dessert": 20,
                  "serves_dinner": 18,
                  "accepts_reservations": 17,
                  "has_wheelchair_accessible_entrance": 17
                },
                "top_place_topics": {
                  "price": 9,
                  "order": 8,
                  "money": 7,
                  "atmosphere": 6,
                  "dominos": 6,
                  "vegan": 6,
                  "cold": 5,
                  "kids": 5,
                  "phone": 5,
                  "dough": 4
                }
              }
            },
            {
              "type": "business_category",
              "categoiries": [
                "pizzatakeaway"
              ],
              "aggregation": {
                "top_categories": {
                  "pizza_restaurant": 14,
                  "pizzatakeaway": 14,
                  "pizza_delivery_service": 8,
                  "restaurant": 8,
                  "fast_food_restaurant": 3,
                  "family_restaurant": 2,
                  "italian_restaurant": 2,
                  "meal_takeaway": 2,
                  "vegan_restaurant": 2,
                  "buffet_restaurant": 1
                },
                "top_countries": {
                  "GB": 14
                },
                "websites_count": 7,
                "count": 14,
                "top_attributes": {
                  "has_delivery": 14,
                  "has_takeout": 14,
                  "feels_casual": 13,
                  "pay_debit_card": 12,
                  "pay_mobile_nfc": 12,
                  "has_no_contact_delivery": 10,
                  "accepts_reservations": 9,
                  "is_transgender_safespace": 9,
                  "serves_dessert": 9,
                  "serves_late_night_food": 8
                },
                "top_place_topics": {
                  "price": 5,
                  "order": 4,
                  "buffet": 3,
                  "ice cream": 3,
                  "kids": 3,
                  "money": 3,
                  "pay": 3,
                  "the pizza": 3,
                  "app": 2,
                  "call": 2
                }
              }
            },
            {
              "type": "business_category",
              "categoiries": [
                "restaurant"
              ],
              "aggregation": {
                "top_categories": {
                  "pizza_restaurant": 12,
                  "restaurant": 12,
                  "pizzatakeaway": 8,
                  "pizza_delivery_service": 5,
                  "italian_restaurant": 3,
                  "neapolitan_restaurant": 3,
                  "family_restaurant": 2,
                  "vegan_restaurant": 2,
                  "buffet_restaurant": 1,
                  "delivery_service": 1
                },
                "top_countries": {
                  "GB": 12
                },
                "websites_count": 3,
                "count": 12,
                "top_attributes": {
                  "has_delivery": 12,
                  "has_takeout": 12,
                  "accepts_reservations": 11,
                  "feels_casual": 11,
                  "is_transgender_safespace": 11,
                  "pay_debit_card": 11,
                  "pay_mobile_nfc": 11,
                  "serves_dessert": 10,
                  "has_no_contact_delivery": 8,
                  "has_wheelchair_accessible_entrance": 8
                },
                "top_place_topics": {
                  "the pizza": 4,
                  "buffet": 3,
                  "ice cream": 3,
                  "incredible pizza": 3,
                  "kids": 3,
                  "order": 3,
                  "pay": 3,
                  "vegan": 3,
                  "app": 2,
                  "atmosphere": 2
                }
              }
            }
          ]
        }
      ]
    }
  ]
}

All POST data should be sent in the JSON format (UTF-8 encoding). The task setting is done using the POST method. When setting a task, you should send all task parameters in the task array of the generic POST array. You can send up to 2000 API calls per minute.

Below you will find a detailed description of the fields you can use for setting a task.

Description of the fields for setting a task:

Field name Type Description
categories array business categories
optional field
the categories you specify are used to search for business listings;
if you don’t use this field, we will return business listings found in the specified location;
you can specify up to 10 categories
description string description of the element in SERP
optional field
the description of the business entity for which the results are collected;
can contain up to 200 characters
title string title of the element in SERP
optional field
the name of the business entity for which the results are collected;
can contain up to 200 characters
is_claimed boolean indicates whether the business is verified by its owner on Google Maps
optional field
location_coordinate string GPS coordinates of a location
optional field
location_coordinate parameter should be specified in the “latitude,longitude,radius” format
the maximum number of decimal digits for “latitude” and “longitude”: 7
the minimum value for “radius”: 1
the maximum value for “radius”: 100000
example:
53.476225,-2.243572,200
initial_dataset_filters array array of results filtering parameters
optional field
you can add several filters at once (8 filters maximum)
you should set a logical operator and, or between the conditions
the following operators are supported:
regex, not_regex, <, <=, >, >=, =, <>, in, not_in, like, not_like
you can use the % operator with like and not_like to match any string of zero or more characters
example:
["rating.value",">",3]

you can receive the list of available filters by making a separate request to https://api.dataforseo.com/v3/business_data/business_listings/available_filters

internal_list_limit integer maximum number of elements within internal arrays
optional field
you can use this field to limit the number of elements within the aggregated categories
default value: 10
limit integer the maximum number of returned businesses
optional field
default value: 100
maximum value: 1000
offset integer the maximum number of returned businesses
optional field
tag string user-defined task identifier
optional field
the character limit is 255
you can use this parameter to identify the task and match it with the result
you will find the specified tag value in the data object of the response

‌‌‌‌‌
As a response of the API server, you will receive JSON-encoded data containing a tasks array with the information specific to the set tasks.

Description of the fields in the results array:

Field name Type Description
version string the current version of the API
status_code integer general status code
you can find the full list of the response codes here
Note: we strongly recommend designing a necessary system for handling related exceptional or error conditions
status_message string general informational message
you can find the full list of general informational messages here
time string execution time, seconds
cost float total tasks cost, USD
tasks_count integer the number of tasks in the tasksarray
tasks_error integer the number of tasks in the tasks array returned with an error
tasks array array of tasks
        id string unique task identifier in our system
in the Universally unique identifier (UUID) format
        status_code integer status code of the task
generated by DataForSEO; can be within the following range: 10000-60000
        status_message string informational message of the task
        time string execution time, seconds
        cost float cost of the task, USD
        result_count integer number of elements in the result array
        path array URL path
        data object contains the same parameters that you specified in the POST request
        result array array of results
            total_count integer total number of results in our database relevant to your request
            count integer item types
the number of items in the items array
           offset integer offset in the results array of returned categories
           offset_token string token for subsequent requests
by specifying the unique offset_token when setting a new task, you will get the subsequent results of the initial task;
offset_token values are unique for each subsequent task
            items array encountered item types
types of search engine results encountered in the items array;
possible item types: business_category
                type string type of element = ‘business_category’
                categories array business categories
Google My Business general category that best describes the cluster of related categories
                aggregation object aggregation of the category
                    top_categories object the most mentioned related categories
top categories displayed with the number of businesses in each category
                    top_countries object the most mentioned counties
country codes with the biggest number of businesses in the category
                    websites_count integer number of unique websites
                    count integer number of unique entities
                    top_attributes object the most mentioned service details
service details of a business entity displayed in a form of checks and the number of entities mentioning each attribute
                    top_place_topics object top keywords mentioned in customer reviews
contains most popular keywords related to products/services mentioned in customer reviews of a business entity and the number of reviews mentioning each keyword

‌‌