Scheduled query runs endpoint
Sample API calls
Now that you understand what headers to use, you are ready to begin making calls to the Query Service API. The following sections walk through the various API calls you can make using the Query Service API. Each call includes the general API format, a sample request showing required headers, and a sample response.
Retrieve a list of all runs for a specified scheduled query
You can retrieve a list of all runs for a specific scheduled query, regardless of whether they are currently running or already completed. This is done by making a GET request to the /schedules/{SCHEDULE_ID}/runs
endpoint, where {SCHEDULE_ID}
is the id
value of the scheduled query whose runs you wish to retrieve.
API format
GET /schedules/{SCHEDULE_ID}/runs
GET /schedules/{SCHEDULE_ID}/runs?{QUERY_PARAMETERS}
{SCHEDULE_ID}
id
value of the scheduled query you want to retrieve.{QUERY_PARAMETERS}
&
). The available parameters are listed below.Query parameters
The following is a list of available query parameters for listing runs for a specified scheduled query. All of these parameters are optional. Making a call to this endpoint with no parameters will retrieve all runs available for the specified scheduled query.
orderby
created
and updated
. For example, orderby=created
will sort results by created in ascending order. Adding a -
before created (orderby=-created
) will sort items by created in descending order.limit
start
ISO timestamps allow for different levels of granularity in the date and time. The basic ISO timestamps take the format of:
2020-09-07
to express the date September 7, 2020. A more complex example would be written as 2022-11-05T08:15:30-05:00
and corresponds to November 5, 2022, 8:15:30 am, US Eastern Standard Time. A timezone can be provided with a UTC offset and is denoted by the suffix āZā (2020-01-01T01:01:01Z
). If no timezone is provided, it defaults to zero.property
created
, state
, and externalTrigger
. The list of supported operators are >
(greater than), <
(less than), and ==
(equal to), and !=
(not equal to). For example, externalTrigger==true,state==SUCCESS,created>2019-04-20T13:37:00Z
will return all runs that manually created, succeeded, and created after April 20th, 2019.Request
The following request retrieves the last four runs for the specified scheduled query.
curl -X GET https://platform.adobe.io/data/foundation/query/schedules/e95186d65a28abf00a495d82_28e74200-e3de-11e9-8f5d-7f27416c5f0d_sample_scheduled_query7omob151bm_birvwm/runs?limit=4
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'x-gw-ims-org-id: {ORG_ID}' \
-H 'x-api-key: {API_KEY}' \
-H 'x-sandbox-name: {SANDBOX_NAME}'
Response
A successful response returns HTTP status 200 with a list of runs for the specified scheduled query as JSON. The following response returns the last four runs for the specified scheduled query.
{
"runsSchedules": [
{
"state": "SUCCESS",
"version": 1,
"id": "c2NoZWR1bGVkX18yMDIwLTAxLTA4VDEyOjMwOjAwKzAwOjAw",
"externalTrigger": "false",
"created": "2020-01-08T12:30:00Z",
"_links": {
"self": {
"href": "https://platform.adobe.io/data/foundation/query/schedules/e95186d65a28abf00a495d82_28e74200-e3de-11e9-8f5d-7f27416c5f0d_sample_scheduled_query7omob151bm_birvwm/runs/c2NoZWR1bGVkX18yMDIwLTAxLTA4VDEyOjMwOjAwKzAwOjAw",
"method": "GET"
},
"cancel": {
"href": "https://platform.adobe.io/data/foundation/query/schedules/e95186d65a28abf00a495d82_28e74200-e3de-11e9-8f5d-7f27416c5f0d_sample_scheduled_query7omob151bm_birvwm/runs/c2NoZWR1bGVkX18yMDIwLTAxLTA4VDEyOjMwOjAwKzAwOjAw",
"method": "PATCH",
"body": "{ \"op\": \"cancel\" }"
}
}
},
{
"state": "SUCCESS",
"version": 1,
"id": "c2NoZWR1bGVkX18yMDIwLTAxLTA4VDEzOjMwOjAwKzAwOjAw",
"externalTrigger": "false",
"created": "2020-01-08T13:30:00Z",
"_links": {
"self": {
"href": "https://platform.adobe.io/data/foundation/query/schedules/e95186d65a28abf00a495d82_28e74200-e3de-11e9-8f5d-7f27416c5f0d_sample_scheduled_query7omob151bm_birvwm/runs/c2NoZWR1bGVkX18yMDIwLTAxLTA4VDEzOjMwOjAwKzAwOjAw",
"method": "GET"
},
"cancel": {
"href": "https://platform.adobe.io/data/foundation/query/schedules/e95186d65a28abf00a495d82_28e74200-e3de-11e9-8f5d-7f27416c5f0d_sample_scheduled_query7omob151bm_birvwm/runs/c2NoZWR1bGVkX18yMDIwLTAxLTA4VDEzOjMwOjAwKzAwOjAw",
"method": "PATCH",
"body": "{ \"op\": \"cancel\" }"
}
}
},
{
"state": "SUCCESS",
"version": 1,
"id": "c2NoZWR1bGVkX18yMDIwLTAxLTA4VDE0OjMwOjAwKzAwOjAw",
"externalTrigger": "false",
"created": "2020-01-08T14:30:00Z",
"_links": {
"self": {
"href": "https://platform.adobe.io/data/foundation/query/schedules/e95186d65a28abf00a495d82_28e74200-e3de-11e9-8f5d-7f27416c5f0d_sample_scheduled_query7omob151bm_birvwm/runs/c2NoZWR1bGVkX18yMDIwLTAxLTA4VDE0OjMwOjAwKzAwOjAw",
"method": "GET"
},
"cancel": {
"href": "https://platform.adobe.io/data/foundation/query/schedules/e95186d65a28abf00a495d82_28e74200-e3de-11e9-8f5d-7f27416c5f0d_sample_scheduled_query7omob151bm_birvwm/runs/c2NoZWR1bGVkX18yMDIwLTAxLTA4VDE0OjMwOjAwKzAwOjAw",
"method": "PATCH",
"body": "{ \"op\": \"cancel\" }"
}
}
},
{
"state": "IN_PROGRESS",
"version": 1,
"id": "c2NoZWR1bGVkX18yMDIwLTAxLTA4VDE4OjQ1OjAwKzAwOjAw",
"externalTrigger": "false",
"created": "2020-01-08T15:30:00Z",
"_links": {
"self": {
"href": "https://platform.adobe.io/data/foundation/query/schedules/e95186d65a28abf00a495d82_28e74200-e3de-11e9-8f5d-7f27416c5f0d_sample_scheduled_query7omob151bm_birvwm/runs/c2NoZWR1bGVkX18yMDIwLTAxLTA4VDE4OjQ1OjAwKzAwOjAw",
"method": "GET"
},
"cancel": {
"href": "https://platform.adobe.io/data/foundation/query/schedules/e95186d65a28abf00a495d82_28e74200-e3de-11e9-8f5d-7f27416c5f0d_sample_scheduled_query7omob151bm_birvwm/runs/c2NoZWR1bGVkX18yMDIwLTAxLTA4VDE4OjQ1OjAwKzAwOjAw",
"method": "PATCH",
"body": "{ \"op\": \"cancel\" }"
}
}
}
],
"_page": {
"orderby": "+created",
"start": "2020-01-08T12:30:00Z",
"count": 4
},
"_links": {},
"version": 1
}
_links.cancel
to stop a run for a specified scheduled query.Immediately trigger a run for a specific scheduled query
You can immediately trigger a run for a specified scheduled query by making a POST request to the /schedules/{SCHEDULE_ID}/runs
endpoint, where {SCHEDULE_ID}
is the id
value of the scheduled query whose run you wish to trigger.
API format
POST /schedules/{SCHEDULE_ID}/runs
Request
curl -X POST https://platform.adobe.io/data/foundation/query/schedules/e95186d65a28abf00a495d82_28e74200-e3de-11e9-8f5d-7f27416c5f0d_sample_scheduled_query7omob151bm_birvwm/runs
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'x-gw-ims-org-id: {ORG_ID}' \
-H 'x-api-key: {API_KEY}' \
-H 'x-sandbox-name: {SANDBOX_NAME}'
Response
A successful response returns HTTP status 202 (Accepted) with the following message.
{
"message": "Request to trigger run of a scheduled query accepted.",
"statusCode": 202
}
Retrieve details of a run for a specific scheduled query
You can retrieve details about a run for a specific scheduled query by making a GET request to the /schedules/{SCHEDULE_ID}/runs/{RUN_ID}
endpoint and providing both the ID of the scheduled query and the run in the request path.
API format
GET /schedules/{SCHEDULE_ID}/runs/{RUN_ID}
{SCHEDULE_ID}
id
value of the scheduled query whose run you wish to retrieve details of.{RUN_ID}
id
value of the run you wish to retrieve.Request
curl -X GET https://platform.adobe.io/data/foundation/query/schedules/e95186d65a28abf00a495d82_28e74200-e3de-11e9-8f5d-7f27416c5f0d_sample_scheduled_query7omob151bm_birvwm/runs/c2NoZWR1bGVkX18yMDIwLTAxLTA4VDIwOjQ1OjAwKzAwOjAw
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'x-gw-ims-org-id: {ORG_ID}' \
-H 'x-api-key: {API_KEY}' \
-H 'x-sandbox-name: {SANDBOX_NAME}'
Response
A successful response returns HTTP status 200 with details of the specified run.
{
"state": "success",
"taskStatusList": [
{
"duration": 303,
"endDate": "2020-01-08T23:49:02.346318",
"state": "SUCCESS",
"message": "Processed Successfully",
"startDate": "2020-01-08T23:43:58.936269",
"taskId": "7Omob151BM"
}
],
"version": 1,
"id": "c2NoZWR1bGVkX18yMDIwLTAxLTA4VDIwOjQ1OjAwKzAwOjAw",
"scheduleId": "e95186d65a28abf00a495d82_28e74200-e3de-11e9-8f5d-7f27416c5f0d_sample_scheduled_query7omob151bm_birvwm",
"externalTrigger": "false",
"created": "2020-01-08T20:45:00",
"_links": {
"self": {
"href": "https://platform.adobe.io/data/foundation/query/schedules/e95186d65a28abf00a495d82_28e74200-e3de-11e9-8f5d-7f27416c5f0d_sample_scheduled_query7omob151bm_birvwm/runs/c2NoZWR1bGVkX18yMDIwLTAxLTA4VDIwOjQ1OjAwKzAwOjAw",
"method": "GET"
},
"cancel": {
"href": "https://platform.adobe.io/data/foundation/query/schedules/e95186d65a28abf00a495d82_28e74200-e3de-11e9-8f5d-7f27416c5f0d_sample_scheduled_query7omob151bm_birvwm/runs/c2NoZWR1bGVkX18yMDIwLTAxLTA4VDIwOjQ1OjAwKzAwOjAw",
"method": "PATCH",
"body": "{ \"op\": \"cancel\" }"
}
}
}
Immediately stop a run for a specific scheduled query
You can immediately stop a run for a specific scheduled query by making a PATCH request to the /schedules/{SCHEDULE_ID}/runs/{RUN_ID}
endpoint and providing both the ID of the scheduled query and the run in the request path.
API format
PATCH /schedules/{SCHEDULE_ID}/runs/{RUN_ID}
{SCHEDULE_ID}
id
value of the scheduled query whose run you wish to retrieve details of.{RUN_ID}
id
value of the run you wish to retrieve.Request
This API request uses the JSON Patch syntax for its payload. For more information on how JSON Patch works, please read the API fundamentals document.
curl -X PATCH https://platform.adobe.io/data/foundation/query/schedules/e95186d65a28abf00a495d82_28e74200-e3de-11e9-8f5d-7f27416c5f0d_sample_scheduled_query7omob151bm_birvwm/runs/c2NoZWR1bGVkX18yMDIwLTAxLTA4VDIwOjQ1OjAwKzAwOjAw
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'x-gw-ims-org-id: {ORG_ID}' \
-H 'x-api-key: {API_KEY}' \
-H 'x-sandbox-name: {SANDBOX_NAME}'
-d '{
"op": "cancel"
}'
Response
A successful response returns HTTP status 202 (Accepted) with the following message.
{
"message": "Request to cancel run of a scheduled query accepted",
"statusCode": 202
}