GET /v2/features/{feature_id}
Description:
This API request returns the feature usage for a given feature id. It is mostly used after calling the Get All Features API which returns the feature ids for a given site.
API Limit:
600 requests per minute. Client receives 429 once over the limit.
Method Details:
Http method: GET
Response format: Json
Headers:
useriq-api-key: Your valid API key generated from the site settings page
Content-Type: application/json
Parameters:
Path Parameters:
- feature_id (required): the feature id
Query Parameters:
- start_date (required,inclusive): the start date of the statistics period, format yyyy-MM-dd
- end_date (requires, exclusive): the end for for the statistics period, format yyyy-MM-dd
Note that the supported max time span between start and end date is 14 days. The client receives a 400 if the timeframe is exceeded.
- user_id (Optional): when supplied the results will only contain feature usage for the user specified
All records may not be returned in a single API call when the feature has a large amount of user participation. In these instances, the results are page. The following parameters are used to customize the paging results.
- count: optional, specify the number of records that are returned in one API call. The default is 2000. The max is 5000.
- offset: optional, used to retrive the next page of results. Each request returns an offset in the response. The offset can be used in the next request to retrieve the next page of results. The default if 0.
Example: count =100, offset = 10, if the api has more than 110 records, the api returns records (offset, count+offset], so records in range (10, 110]. Please note, records are ordered internally.
Clients with a large number of users are encouraged to use the default count and call the api repeatedly with updated offsets to retrieve the whole result set. Clients with smaller numbers of users (<2000) can simply ignore the count and offset parameters.
Response:
Status code 200:
The body contains the result
-
result: a list of feature usages during [start_date, end_date). The feature usages in its current page response are sorted in the descending order of usage
count. -
success: true or false.
-
total: the number of feature usages.
-
offset: the offset to be used in the next api call.
-
has_more: true or false. When true, it means there are more records to be fetched.
Other Status code:
400: Bad request
401: Unauthorized.
429: Too many requests.
1. Example Request:
GET https://api.useriq.com/v2/features/22823?
start_date=2021-11-01&end_date=2021-11-08&count=1000&offset=0
Example Response
{
„has_more”: true,
„total”: 1000,
„offset”: 1000,
„success”: true,
„result”: [
{
„site_id”: 10011234,
„feature_id”: 22823,
„account_id”: „ef524d85-e28f-4afd-97e7-3d70be4de366”,
„user_id”: „085ce554-b77f-4f1f-9bbe-91d39d79f3c9”,
„count”: 76,
„start_date”: „2021-11-01”,
„end_date”: „2021-11-08”
},
{
„site_id”: 10011234,
„feature_id”: 22823,
„account_id”: „92e3a89b-7e41-432e-b3ae-d468230830ac”,
„user_id”: „0237de8e-a0a8-4e54-bbc5-897e0285cb39”,
„count”: 66,
„start_date”: „2021-11-01”,
„end_date”: „2021-11-08”
},
{
„site_id”: 10011234,
„feature_id”: 22823,
„account_id”: „4675bd3c-7ea0-443d-9215-9a388d8df31a”,
„user_id”: „09b2c01e-c77e-41e1-b1ab-4d73cce6d9b0”,
„count”: 64,
„start_date”: „2021-11-01”,
„end_date”: „2021-11-08”
}
]
…
}
2. Example Request for a specfic user only :
GET https://api.useriq.com/v2/features/22823?user_id=0237de8e-a0a8-4e54-bbc5-897e0285cb39
&start_date=2021-11-01&end_date=2021-11-08
Example Response
{
„has_more”: false,
„total”: 1,
„offset”: 1,
„success”: true,
„result”: [
{
„site_id”: 10011234,
„feature_id”: 22823,
„account_id”: „92e3a89b-7e41-432e-b3ae-d468230830ac”,
„user_id”: „0237de8e-a0a8-4e54-bbc5-897e0285cb39”,
„count”: 66,
„start_date”: „2021-11-01”,
„end_date”: „2021-11-08”
}
]
}

Comments
0 comments
Article is closed for comments.