Get Analytics API
This API can be used to fetch analytics data generated by the SearchAssist application. You can apply filters to fetch specific reports.
Method | POST |
Endpoint | <host_url>/searchassistapi/external/stream/<streamId>/analytics |
Content-Type | application/json |
Auth | <JWT Token> |
API Scope | Analytics |
Query Parameters
Parameters | Description | Mandatory |
streamId | Provide your application ID here. | Yes |
indexPipelineId | The index configuration Id | No. When not provided, default index configuration is used. |
Offset | Number of records to skip while fetching the response. | No. When not provided, the default value of 0 is used. |
Limit | This is the number of records to be fetched as response to the API call, starting with a record after the skip count. | No. When not provided, the default value of 50 is used. |
Request Parameters
Parameters | Description | Mandatory |
type | This field can take the following values:
You can also fetch data grouped by user identities using the following types:
|
Yes |
group | This field can take the following values:
|
No |
filters | This field can be used to provide the time frame for which the data is to be generated.
|
No |
Sample Request
{ "type": "QueriesWithResults", "group": "hour", "filters": { "from": "2024-01-01T11:48:34.404Z", "to": "2024-01-05T11:48:34.404Z" } }
Export Analytics API
This API is used to export analytics information to a file. It creates a job of type ‘DATA_EXPORT’ to export the data. To download the file, use the job id and get the URL of the file with exported data using the Job APIs.
Currently, this API limits data export to a maximum duration of a week. If the duration is more than a week, an error is thrown.
Method | POST |
Endpoint | <host_url>/searchassistapi/external/stream/<stream-id>/analytics/export |
Content-Type | application/json |
Authorization | auth: <JWT Token> |
API Scope | Analytics |
Query Parameters
Parameters | Description | Mandatory |
Stream ID | Provide your application ID here. | Yes |
Request Parameters
Parameters | Description | Mandatory |
filters |
This field indicates the time frame for which the data is to be exported.
Note: Currently, the total duration cannot exceed one week. |
No |
Sample Request
{ "filters": { "from": "2024-07-12T07:32:58.611Z", "to": "2024-07-18T07:32:58.611Z" } }
Sample Response
{ "_id": "fj-c18261fa-75c8-5bd9-8c18-2b9f8bbc28a2", "hidden": false, "read": false, "status": "INPROGRESS", "percentageDone": 0, "title": "Exporting Analytics Data - JSON", "message": "Exporting Analytics Data - JSON", "lMod": "2024-07-18T11:11:22.000Z", "startedAt": "2024-07-18T11:11:22.600Z", "timedOut": false, "jobType": "DATA_EXPORT", "streamId": "st-628ade91-3522-5516-8d4c-b475556adfca", "searchIndexId": "sidx-bd7314c5-4cac-5261-a9eb-9b4f1b1026f1", "fileInfo": { "ext": "json" }, "createdBy": "u-088b4f05-31b4-56d9-b59d-70d863a07f5f", "directoryInfo": null, "opType": "Manual", "extractionSourceId": null, "contentId": [], "error": [], "parentJobId": null, "createdOn": "2024-07-18T11:11:22.604Z", "__v": 0 }