Metrics
This endpoint lets you get general metrics for your keyset or account, specifying the timeline for those metrics and how they should be grouped.
To read about the available metrics, categories, and their limitations, refer to the general Insights API documentation.
Example cURL command:
curl --location --globoff 'https://admin.pubnub.com/api/insights?entityType=keyset&entityId=your-subscribe-key&fromDate=YYYY-MM-DD&toDate=YYYY-MM-DD&period=daily&metric[]=unique_users_combination' \ --header 'X-Session-Token: <PASTE TOKEN HERE>'
Query Parameters |
---|
entityType string — REQUIREDPossible values: [ Type of entity you are requesting information for. |
entityId string — REQUIREDAlphanumeric ID of the entity for which you are requesting information.
|
fromDate string — REQUIREDStart of the date range for which you want the metrics (YYYY-MM-DD). |
toDate string — REQUIREDEnd of the date range for which you want the metrics (YYYY-MM-DD). |
period string — REQUIREDPossible values: [ Aggregation of the returned metrics. |
metric[] string[] — REQUIREDPossible values: [ Metric you are requesting data for (one or many). Names are case-sensitive. |
Header Parameters |
---|
X-Session-Token string — REQUIREDAuthentication header |
Responses | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
200 Even if the status code is 200 (success), sometimes you might not see anything returned in dataResult. This can happen when the data you requested is not available at the moment. In such cases, try again later.
| |||||||||||||
400 For example, you can get this error if the period you provided is invalid for the requested metric. In such cases, use a different period to request the metric.
| |||||||||||||
401 This error occurs when you are not authenticated (you didn’t provide the token in the header of an API call).
| |||||||||||||
403 This is a Forbidden resource error.
| |||||||||||||
500 This is a server error (Bad Request). This would usually mean something has gone wrong on PubNub’s end, for example, when the database is down. If you see this error and cannot find the reason for it, contact PubNub support. |