Workspace Metrics
Get metric data for the specified workspace and metric name, optionally aggregated over a specified time period.
The
workspaceId
andmetricName
parameters indicate which workspace to fetch metrics for and what kind of metrics to get.When executing an aggregated query, the result bucket start times will be truncated to the start of an hour or a day, depending on the aggregation interval. However, the buckets will not contain data from outside the requested time range. For example, when passing
from=2020-10-21T10:34:56.000Z
andaggregation=hourly
, the first output bucket would start at2020-10-21T10:00:00.000Z
, but the bucket would only aggregate data timestamped after10:34:56
.For aggregation modes
none
andhourly
, the maximum time span is 48 hours. For aggregation modedaily
, the maximum time span is 30 days.If the aggregation mode query parameter is set to
none
, the returned data in the response will be an array of items with thedeviceId
,timestamp
and the rawvalue
.If the aggregation mode is
hourly
ordaily
, the returned data in the response will be an array of items with thestart
andend
of the aggregation time bucket, and themean
,max
andmin
values of the requested value. Note that zeroes and negative values are ignored. For example, this means that thepeopleCount
mean value should be interpreted as the average number of people in the room when it is in use.
Query Parameters
ID of the workspace to get metrics for.
The type of data to extract.
Time unit over which to aggregate measurements.
List only data points after a specific date and time (ISO 8601 timestamp)
List data points before a specific date and time (ISO 8601 timestamp)
Output data unit (only a valid parameter if metricName
is temperature
).
Sort results.
Response Properties
Output data unit (only present if metricName
is temperature
).
The structure of the elements will depend on whether or not aggregated data was requested
Response Codes
The list below describes the common success and error responses you should expect from the API.
Code | Status | Description |
---|---|---|
200 | OK | Successful request with body content. |
201 | Created | The request has succeeded and has led to the creation of a resource. |
202 | Accepted | The request has been accepted for processing. |
204 | No Content | Successful request without body content. |
400 | Bad Request | The request was invalid or cannot be otherwise served. An accompanying error message will explain further. |
401 | Unauthorized | Authentication credentials were missing or incorrect. |
403 | Forbidden | The request is understood, but it has been refused or access is not allowed. |
404 | Not Found | The URI requested is invalid or the resource requested, such as a user, does not exist. Also returned when the requested format is not supported by the requested method. |
405 | Method Not Allowed | The request was made to a resource using an HTTP request method that is not supported. |
409 | Conflict | The request could not be processed because it conflicts with some established rule of the system. For example, a person may not be added to a room more than once. |
410 | Gone | The requested resource is no longer available. |
415 | Unsupported Media Type | The request was made to a resource without specifying a media type or used a media type that is not supported. |
423 | Locked | The requested resource is temporarily unavailable. A Retry-After header may be present that specifies how many seconds you need to wait before attempting the request again. |
428 | Precondition Required | File(s) cannot be scanned for malware and need to be force downloaded. |
429 | Too Many Requests | Too many requests have been sent in a given amount of time and the request has been rate limited. A Retry-After header should be present that specifies how many seconds you need to wait before a successful request can be made. |
500 | Internal Server Error | Something went wrong on the server. If the issue persists, feel free to contact the Webex Developer Support team. |
502 | Bad Gateway | The server received an invalid response from an upstream server while processing the request. Try again later. |
503 | Service Unavailable | Server is overloaded with requests. Try again later. |
504 | Gateway Timeout | An upstream server failed to respond on time. If your query uses max parameter, please try to reduce it. |
Header
Query Parameters
- workspaceIdstringRequiredID of the workspace to get metrics for.
- metricNamestringRequiredThe type of data to extract.
- aggregationstringTime unit over which to aggregate measurements.
- fromstringList only data points after a specific date and time (ISO 8601 timestamp)
- tostringList data points before a specific date and time (ISO 8601 timestamp)
- unitstringOutput data unit (only a valid parameter if `metricName` is `temperature`).
- sortBystringSort results.
{ "workspaceId": "Y2lzY29zcGFyazovL3VzL09SR0FOSVpBVElPTi85NmFiYzJhYS0zZGNjLTExZTUtYTE1Mi1mZTM0ODE5Y2RjOWE", "metricName": "temperature", "aggregation": "hourly", "from": "2020-10-21T13:33:37.789Z", "to": "2020-10-31T16:00:00.532Z", "unit": "celsius", "sortBy": "newestFirst", "items": [] }