> ## Documentation Index
> Fetch the complete documentation index at: https://learn.servitly.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get statistic value
> Compute and return the statistic value.
According to the selected statistic resource you must have the specific permissions (e.g. READ_THING).
## OpenAPI
````json GET /v2/identity/users/me/statistics
{
"openapi": "3.1.0",
"info": {
"title": "Servitly DPS API",
"version": "1.0.0"
},
"servers": [
{
"url": "https://api.servitly-sandbox.com",
"description": "[AWS SANDBOX]"
},
{
"url": "https://api.servitly.com",
"description": "[AWS PRODUCTION Ireland]"
},
{
"url": "https://api-ap.servitly.com",
"description": "[AWS Hong Kong]"
},
{
"url": "https://azapi.servitly-dev.com",
"description": "[AZURE DEV Frankfurt]"
},
{
"url": "https://azapi.servitly-staging.com",
"description": "[AZURE STAGING Frankfurt]"
},
{
"url": "https://azapi.servitly.com",
"description": "[AZURE PRODUCTION Frankfurt]"
}
],
"security": [
{
"bearerAuth": []
}
],
"tags": [
{
"name": "ACTIONS"
},
{
"name": "ALERTS"
},
{
"name": "API GATEWAY"
},
{
"name": "AUTHENTICATION"
},
{
"name": "AUTHORIZATIONS"
},
{
"name": "CUSTOMERS"
},
{
"name": "DATA IMPORT / EXPORT"
},
{
"name": "EVENTS"
},
{
"name": "LOCATIONS"
},
{
"name": "MAINTENANCE"
},
{
"name": "MAPPING"
},
{
"name": "METRIC DATA"
},
{
"name": "MOBILE APP"
},
{
"name": "ORGANIZATION"
},
{
"name": "PARTNERS"
},
{
"name": "PRODUCT MODELS"
},
{
"name": "SPARE PARTS"
},
{
"name": "STATISTICS"
},
{
"name": "STORE ORDERS"
},
{
"name": "SUBSCRIPTIONS"
},
{
"name": "SUBSCRIPTIONS (OLD)"
},
{
"name": "THING CONTROL"
},
{
"name": "THING DEFINITIONS"
},
{
"name": "THING MANAGEMENT"
},
{
"name": "THINGS"
},
{
"name": "TICKETS"
},
{
"name": "USER TYPES"
},
{
"name": "USERS"
},
{
"name": "WORK SESSIONS"
}
],
"paths": {
"/v2/identity/users/me/statistics": {
"get": {
"summary": "Get statistic value",
"description": "Compute and return the statistic value.
According to the selected statistic resource you must have the specific permissions (e.g. READ_THING).",
"tags": [
"STATISTICS"
],
"parameters": [
{
"$ref": "#/components/parameters/tenantNameHeader"
},
{
"$ref": "#/components/parameters/resource"
},
{
"$ref": "#/components/parameters/periodStart"
},
{
"$ref": "#/components/parameters/periodEnd"
},
{
"$ref": "#/components/parameters/aggregation"
},
{
"$ref": "#/components/parameters/statitic_property"
},
{
"$ref": "#/components/parameters/thingId"
},
{
"$ref": "#/components/parameters/locationId"
},
{
"$ref": "#/components/parameters/customerId"
},
{
"$ref": "#/components/parameters/groupBy"
},
{
"$ref": "#/components/parameters/statistic_limit"
},
{
"$ref": "#/components/parameters/statistic_sort"
},
{
"$ref": "#/components/parameters/statistic_activationType"
},
{
"$ref": "#/components/parameters/statistic_averagedBy"
},
{
"$ref": "#/components/parameters/query_property"
}
],
"responses": {
"200": {
"description": "Successful operation.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/StatisticResult"
}
}
}
},
"401": {
"$ref": "#/components/responses/NotAuthenticated"
},
"403": {
"$ref": "#/components/responses/NotAuthorized"
},
"404": {
"$ref": "#/components/responses/NotFound"
},
"429": {
"$ref": "#/components/responses/ApiLimit"
},
"500": {
"$ref": "#/components/responses/IntError"
}
}
}
}
},
"components": {
"parameters": {
"tenantNameHeader": {
"in": "header",
"name": "X-Servitly-Tenant",
"required": "true",
"schema": {
"type": "string",
"example": "{{tenantName}}"
},
"description": "The name of the tenant (e.g. acme)."
},
"resource": {
"in": "query",
"name": "resource",
"required": "false",
"schema": {
"type": "string",
"enum": [
"action",
"alert",
"customer",
"location",
"partner",
"thing",
"user",
"work_session"
],
"example": "thing"
},
"description": "The resource from which to retrieve the items to be used to calculate the statistic (action, alert, customer, location, partner, thing, user, work_session)."
},
"periodStart": {
"in": "query",
"name": "periodStart",
"required": "false",
"schema": {
"type": "integer",
"format": "int64",
"example": "1578438000000"
},
"description": "Condition to get time-based items after a specific timestamp."
},
"periodEnd": {
"in": "query",
"name": "periodEnd",
"required": "false",
"schema": {
"type": "integer",
"format": "int64",
"example": "1578438000000"
},
"description": "Condition to get time-based items before a specific timestamp."
},
"aggregation": {
"in": "query",
"name": "aggregation",
"required": "false",
"schema": {
"type": "string",
"enum": [
"AVG",
"COUNT",
"MAX",
"MIN",
"SUM"
],
"example": "SUM"
},
"description": "The function used to aggregate data (AVG, COUNT, MAX, MIN, SUM). Except for COUNT, the other functions also require a property to aggregate."
},
"statitic_property": {
"in": "query",
"name": "property",
"required": "false",
"schema": {
"type": "string",
"example": "property.prop_1"
},
"description": "The object property whose values must be aggregated."
},
"thingId": {
"in": "query",
"name": "thingId",
"required": "false",
"schema": {
"type": "string",
"example": "abcd1234"
},
"description": "Condition on thing id."
},
"locationId": {
"in": "query",
"name": "locationId",
"required": "false",
"schema": {
"type": "string",
"example": "abcd1234"
},
"description": "Condition on location id."
},
"customerId": {
"in": "query",
"name": "customerId",
"required": "false",
"schema": {
"type": "string",
"example": "abcd1234"
},
"description": "Condition on customer id."
},
"groupBy": {
"in": "query",
"name": "groupBy",
"required": "false",
"schema": {
"type": "string",
"example": "productModel.name"
},
"description": "The property used to group statistic results."
},
"statistic_limit": {
"in": "query",
"name": "limit",
"required": "false",
"schema": {
"type": "integer"
},
"example": "10",
"description": "The maximum number of results to return."
},
"statistic_sort": {
"in": "query",
"name": "sortDirection",
"required": "false",
"schema": {
"type": "string",
"enum": [
"ASC",
"DESC"
]
},
"example": "DESC",
"description": "The direction used to sort statistic results by value (ASC, DESC)."
},
"statistic_activationType": {
"in": "query",
"name": "activationType",
"required": "false",
"schema": {
"type": "string",
"enum": [
"ACTIVE",
"ACTIVATED"
]
},
"example": "ACTIVATED",
"description": "Defines whether to include events that are still active or that have been activated in a period."
},
"statistic_averagedBy": {
"in": "query",
"name": "averagedBy",
"required": "false",
"schema": {
"type": "string",
"enum": [
"thingCount"
]
},
"example": "thingCount",
"description": "The item count used to average the statistic result values."
},
"query_property": {
"in": "query",
"name": "PROPERTY_NAME",
"required": "false",
"schema": {
"type": "string",
"example": "properties.propABC=eq;XYZ"
},
"description": "Condition on object property.
For more details on predicates, see the payload common concepts article."
}
},
"schemas": {
"StatisticResult": {
"type": "array",
"items": {
"type": "object",
"properties": {
"value": {
"type": "number",
"description": "The statistic value.",
"example": "100"
},
"category": {
"type": "string",
"description": "The statistic aggregation category.",
"example": "Category-1"
}
}
}
}
},
"responses": {
"NotAuthenticated": {
"description": "User not authenticated.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"description": "The error response.",
"example": "User not authenticated"
}
}
}
}
}
},
"NotAuthorized": {
"description": "User not authorized.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"description": "The error response.",
"example": "User not authorized"
}
}
}
}
}
},
"NotFound": {
"description": "Resource was not found.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"description": "The error response.",
"example": "Resource not found"
}
}
}
}
}
},
"ApiLimit": {
"description": "API call rate limit exceeded.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"description": "The error response.",
"example": "API call rate limit exceeded"
}
}
}
}
}
},
"IntError": {
"description": "Internal server error.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"description": "The error response.",
"example": "Internal Server Error"
}
}
}
}
}
}
},
"securitySchemes": {
"bearerAuth": {
"type": "http",
"scheme": "bearer"
}
}
}
}
````