Retrieve Data
Retrieve Data
GET
https://app.contentstack.com/analytics/v2/job/{jobId}/data?orgUid=<string>&page=0The Retrieve Data request will take the jobId value that was generated in your response, as a part of its URL and returns the result of that job. Because the analytics APIs run asynchronously, the job may still be in progress when you call it. Repeat the request until it returns your data.
Note
- Replace the jobId value in your URL with the jobId value received in your response. For example: {{api_server}}/analytics/v2/job/job_0******9-b**d-4**b-9**0-4**********2/data
- The page parameter is optional and defaults to 0. When paginated is true in the job response, pass a whole number (0, 1, 2, and so on) to fetch that page. A page number that does not exist, or a value that is not a whole number, returns a 404 No data found error.
- A jobId can only be retrieved by the same user who created it, within the same organization. Requests from any other user return a 404 error, so a jobId cannot be handed off between users or integrations.
The response depends on the state of the job. A queued or running job returns a 200 with a status message rather than your data, so read the job state from the response body and not from the status code.
| Job state | Status | Response body |
|---|---|---|
| Queued | 200 | {"message": "Job waiting", "statusCode": 200} |
| Running | 200 | {"message": "Job active", "statusCode": 200} |
| Finished | 200 | Your data |
| Failed | 500 | {"message": "Job failed"} |
| Unknown jobId | 404 | {"message": "Job not found"} |
| No such page | 404 | {"message": "No data found"} |
You will receive the response depending on your request and relevant jobId.
Sample Response
Status|200 OK
{
"data": [
{
"total_launch_project": 52,
"total_launch_env": 42,
"total_launch_domain": 62
}
],
"meta": {
"includeCount": "true",
"services": "[\"cdn\",\"cma\"]",
"from": "2024-01-01",
"duration": "day",
"to": "2024-05-28",
"orgUid": "blt426dad4d38234fd5"
},
"uid": "c13878ab-ff27-4b9c-ae99-a085c8f75f7d"
}