▪ Clusters Compare
Clusters Compare API returns two different clusters data sets at once: one defined by the specified {Location} and [from,to] query parameters and another defined by compare_ prefixed query parameters (or auto-calculated with default values where specified).
Additional comparative data between the two data sets is returned as well.
Request
Endpoint
GET
/v4/{billing_plan}/account/{account_id}/locations/clusters/overall/compare
Path Parameters
| Name | Description | Type | Examples | 
|---|---|---|---|
| *{billing_plan} | Billing plan to be applied to the call. | string | ondemand | 
| *{account_id} | Provided identifier of the account. | string | |
| /sample | Filter data for POIs that are included in the sample (subset of POIs that statistically replicates the population of the corresponding location). | string | 
/sample optional path parameter
Inserting optional path parameter /sample in the following position:
- /v4/{billing_plan}/account/{account_id}/locations/sample/…
will filter data for POIs that are included in the sample (subset of POIs that statistically replicates the population of the corresponding location).
Header Parameters
| Name | Description | Type | Examples | 
|---|---|---|---|
| *x-api-key | Provided API key {x_api_key}that allows authentication. | string | |
| *Authorization | Provided token {jwt_bearer}that allows authorization. | string | Bearer {jwt_bearer} | 
Query Parameters
| Name | Description | Type | Examples | Default | 
|---|---|---|---|---|
| *{Location} | Actual location identifier. | Geospatial | AreaGeometryIDCircle | |
| *from | Start date of actual timeframe. | date | 2020-01-01 | |
| *to | End date of actual timeframe. | date | 2020-12-31 | |
| {ComparisonLocation} | Comparison location identifier. | Comparison | ComparisonAreaComparisonGeometryIDComparisonCircle | Same as {Location}. | 
| compare_from | Start date of comparison timeframe. | date | 2020-07-01 | One year before from. | 
| compare_to | End date of comparison timeframe. | date | 2021-01-01 | One year before to. | 
| ⓝ topic | Filter by topic. | string | 2 starsdinner | |
| ⓝ cluster | Filter by cluster. | string | Dictionary | |
| ⓝ networkⓝ compare_network | Filter by network. | string | Dictionary | |
| ⓝ poi_classⓝ compare_poi_class | Filter POIs with "category": "hotel"by stars rating in the range [1,5]. | int | 4 | |
| ⓝ poi_industryⓝ compare_poi_industry | Filter by POI Industry. | string | Dictionary | |
| ⓝ poi_categoryⓝ compare_poi_category | Filter by POI Category. | string | Dictionary | |
| language | Translate cluster names in the specified language.It also allows the user to filter by clusterparameter by setting its value in the specified language. | string | itfr | en | 
| ⓝ user_typeⓝ compare_user_type | Filter by reviewer type. | string | Dictionary | |
| ⓝ user_countryⓝ compare_user_country | Filter by reviewer's country of origin in ISO 3166-1 alpha-2 standard format (in lower case). | string | itde | |
| ⓝ content_languageⓝ compare_content_language | Filter by contents language in ISO_639-1 standard format. | string | enfr | |
| ⓝ content_typeⓝ compare_content_type | Filter by type of content. | string | postreviewtaggedpost | review && taggedpost | 
| page | Requested page number for paginated results. | int | 1 | |
| page_size | Requested page size for paginated results in the range [1, 100]. | int | 25 | 
Supported values for language
- en
- it
- fr
- es
- de
Example
curl -X GET 'https://api.datappeal.io/v4/ondemand/account/{account_id}/locations/clusters/overall/compare?geometry_id=379c730942e570d586a5520770c0a65d&from=2021-01-01&to=2021-07-01&compare_from=2020-07-01&compare_to=2021-01-01&page_size=2' \
-H 'x-api-key: {x_api_key}' \
-H 'Authorization: Bearer {jwt_bearer}' \
Example /sample
curl -X GET 'https://api.datappeal.io/v4/ondemand/account/{account_id}/locations/sample/clusters/overall/compare?geometry_id=379c730942e570d586a5520770c0a65d&from=2021-01-01&to=2021-07-01&compare_from=2020-07-01&compare_to=2021-01-01&page_size=2' \
-H 'x-api-key: {x_api_key}' \
-H 'Authorization: Bearer {jwt_bearer}' \
Response
Status
| Status | Description | 
|---|---|
| 200 | Clusters Compare data has been successfully returned. | 
Body
LocationComparedClusters
| Field | Description | Type | 
|---|---|---|
| *results | Paginated compared clusters data. | LocationComparedClustersResults | 
| paging | Response pagination. | Paging | 
LocationComparedClustersResults
| Field | Description | Type | 
|---|---|---|
| actual | Clusters grouped data for the requested timeframe. | LocationComparableClusters | 
| comparison | Clusters grouped data for comparison timeframe. | LocationComparableClusters | 
| variation | Calculated difference between actualandcomparison. | array[LocationClusterVariation] | 
LocationComparableClusters
| Field | Description | Type | 
|---|---|---|
| timeframe | Reference date range. | Timeframe | 
| value | Clusters data for the corresponding timeframe. | array[LocationCluster] | 
Timeframe
| Field | Description | Type | 
|---|---|---|
| *from | Start date of timeframe. | date | 
| *to | End date of timeframe. | date | 
LocationCluster
| Field | Description | Type | 
|---|---|---|
| cluster | Descriptive identifier of the cluster. | string | 
| contents | Total count of contents. | Total | 
| opinions | Total and grouped by polarity count of opinions. | PolarizedCount | 
| sentiment | KPI which indicates users global satisfaction. | PolarizedValue | 
Total
| Field | Description | Type | 
|---|---|---|
| total | Total count of elements. | int | 
PolarizedCount
| Field | Description | Type | 
|---|---|---|
| positive | Positive elements count. | int | 
| negative | Negative elements count. | int | 
| neutral | Neutral elements count. | int | 
| total | Total elements count. | int | 
PolarizedValue
| Field | Description | Type | Examples | 
|---|---|---|---|
| value | Value of the including field in the range [0,100]. | decimal | 60.3 59.7 | 
| polarity | Polarity of the corresponding value. | string | POSITIVE NEGATIVE | 
LocationClusterVariation
| Field | Description | Type | 
|---|---|---|
| *opinions | Grouped by polarity opinions variation. | PolarizedVariation | 
| *contents | Grouped by polarity contents variation. | TotalVariation | 
| *sentiment | Sentiment variation. | Variation | 
| *cluster | Descriptive identifier of the cluster. | string | 
PolarizedVariation
| Field | Description | Type | 
|---|---|---|
| positive | Positive elements count variation. | Variation | 
| negative | Negative elements count variation. | Variation | 
| neutral | Neutral elements count variation. | Variation | 
| total | Total elements count variation. | Variation | 
TotalVariation
| Field | Description | Type | 
|---|---|---|
| total | Total elements count variation. | Variation | 
Variation
| Field | Description | Type | Examples | 
|---|---|---|---|
| value | Difference between actualvalue andcomparisonvalue. | decimal | 1.12 | 
| variation | The explicit variation polarity. It is nullwhen values are not available in both timeframes. | string | POSITIVE NEUTRAL NEGATIVE | 
Paging
| Field | Description | Type | 
|---|---|---|
| last | A relative URI to the last page. | string | 
| first | A relative URI to the first page. | string | 
| prev | A relative URI to the previous page. | string | 
| next | A relative URI to the next page. | string | 
| current | A relative URI to the current page. | string | 
| pages | A set of relative URIs calculated around the current page. | Page | 
| elements | All indexes shown on the current page. | array[int] | 
| total | The number of all elements that API can retrieve. | int | 
| size | The selected page size. | int | 
Page
| Field | Description | Type | 
|---|---|---|
| number | Number of the page. | int | 
| uri | URI of the page. | string | 
Example
{
    "results": {
        "actual": {
            "timeframe": {
                "from": "2021-01-01",
                "to": "2021-07-01"
            },
            "value": [
                {
                    "cluster": "atmosphere",
                    "contents": {
                        "total": 36332
                    },
                    "opinions": {
                        "positive": 57171,
                        "negative": 6165,
                        "neutral": 0,
                        "total": 63336
                    },
                    "sentiment": {
                        "value": 90.27,
                        "polarity": "POSITIVE"
                    }
                },
                {
                    "cluster": "hospitality",
                    "contents": {
                        "total": 20532
                    },
                    "opinions": {
                        "positive": 30591,
                        "negative": 2044,
                        "neutral": 0,
                        "total": 32635
                    },
                    "sentiment": {
                        "value": 93.74,
                        "polarity": "POSITIVE"
                    }
                }
            ]
        },
        "comparison": {
            "timeframe": {
                "from": "2020-07-01",
                "to": "2021-01-01"
            },
            "value": [
                {
                    "cluster": "atmosphere",
                    "contents": {
                        "total": 92390
                    },
                    "opinions": {
                        "positive": 154640,
                        "negative": 18370,
                        "neutral": 0,
                        "total": 173010
                    },
                    "sentiment": {
                        "value": 89.38,
                        "polarity": "POSITIVE"
                    }
                },
                {
                    "cluster": "hospitality",
                    "contents": {
                        "total": 42919
                    },
                    "opinions": {
                        "positive": 63155,
                        "negative": 4590,
                        "neutral": 0,
                        "total": 67745
                    },
                    "sentiment": {
                        "value": 93.22,
                        "polarity": "POSITIVE"
                    }
                }
            ]
        },
        "variation": [
            {
                "opinions": {
                    "positive": {
                        "value": -97469,
                        "variation": "NEGATIVE"
                    },
                    "negative": {
                        "value": -12205,
                        "variation": "POSITIVE"
                    },
                    "neutral": {
                        "value": 0,
                        "variation": "NEUTRAL"
                    },
                    "total": {
                        "value": -109674,
                        "variation": "NEGATIVE"
                    }
                },
                "contents": {
                    "total": {
                        "value": -56058,
                        "variation": "NEGATIVE"
                    }
                },
                "sentiment": {
                    "value": 0.89,
                    "variation": "POSITIVE"
                },
                "cluster": "atmosphere"
            },
            {
                "opinions": {
                    "positive": {
                        "value": -32564,
                        "variation": "NEGATIVE"
                    },
                    "negative": {
                        "value": -2546,
                        "variation": "POSITIVE"
                    },
                    "neutral": {
                        "value": 0,
                        "variation": "NEUTRAL"
                    },
                    "total": {
                        "value": -35110,
                        "variation": "NEGATIVE"
                    }
                },
                "contents": {
                    "total": {
                        "value": -22387,
                        "variation": "NEGATIVE"
                    }
                },
                "sentiment": {
                    "value": 0.52,
                    "variation": "POSITIVE"
                },
                "cluster": "hospitality"
            }
        ]
    },
    "paging": {
        "last": "/clusters/overall/compare?page=22&page_size=2&geometry_id=379c730942e570d586a5520770c0a65d&compare_from=2020-07-01&from=2021-01-01&to=2021-07-01&compare_to=2021-01-01",
        "first": "/clusters/overall/compare?page=1&page_size=2&geometry_id=379c730942e570d586a5520770c0a65d&compare_from=2020-07-01&from=2021-01-01&to=2021-07-01&compare_to=2021-01-01",
        "prev": null,
        "next": "/clusters/overall/compare?page=2&page_size=2&geometry_id=379c730942e570d586a5520770c0a65d&compare_from=2020-07-01&from=2021-01-01&to=2021-07-01&compare_to=2021-01-01",
        "current": "/clusters/overall/compare?page=1&page_size=2&geometry_id=379c730942e570d586a5520770c0a65d&compare_from=2020-07-01&from=2021-01-01&to=2021-07-01&compare_to=2021-01-01",
        "pages": [
            {
                "number": 1,
                "uri": "/clusters/overall/compare?page=1&page_size=2&geometry_id=379c730942e570d586a5520770c0a65d&compare_from=2020-07-01&from=2021-01-01&to=2021-07-01&compare_to=2021-01-01"
            },
            {
                "number": 2,
                "uri": "/clusters/overall/compare?page=2&page_size=2&geometry_id=379c730942e570d586a5520770c0a65d&compare_from=2020-07-01&from=2021-01-01&to=2021-07-01&compare_to=2021-01-01"
            },
            {
                "number": 3,
                "uri": "/clusters/overall/compare?page=3&page_size=2&geometry_id=379c730942e570d586a5520770c0a65d&compare_from=2020-07-01&from=2021-01-01&to=2021-07-01&compare_to=2021-01-01"
            },
            {
                "number": 4,
                "uri": "/clusters/overall/compare?page=4&page_size=2&geometry_id=379c730942e570d586a5520770c0a65d&compare_from=2020-07-01&from=2021-01-01&to=2021-07-01&compare_to=2021-01-01"
            },
            {
                "number": 5,
                "uri": "/clusters/overall/compare?page=5&page_size=2&geometry_id=379c730942e570d586a5520770c0a65d&compare_from=2020-07-01&from=2021-01-01&to=2021-07-01&compare_to=2021-01-01"
            }
        ],
        "elements": [
            1,
            2
        ],
        "total": 44,
        "size": 2
    }
}