Schedules endpoint
Schedules are a tool that can be used to automatically run batch segmentation jobs once a day. You can use the /config/schedules endpoint to retrieve a list of schedules, create a new schedule, retrieve details of a specific schedule, update a specific schedule, or delete a specific schedule.
Getting started
The endpoints used in this guide are part of the Adobe Experience Platform Segmentation Service API. Before continuing, please review the getting started guide for important information that you need to know in order to successfully make calls to the API, including required headers and how to read example API calls.
Retrieve a list of schedules retrieve-list
You can retrieve a list of all schedules for your organization by making a GET request to the /config/schedules endpoint.
API format
The /config/schedules endpoint supports several query parameters to help filter your results. While these parameters are optional, their use is strongly recommended to help reduce expensive overhead. Making a call to this endpoint with no parameters will retrieve all schedules available for your organization. Multiple parameters can be included, separated by ampersands (&).
GET /config/schedules
GET /config/schedules?{QUERY_PARAMETERS}
Query parameters
| table 0-row-3 1-row-3 2-row-3 | ||
|---|---|---|
| Parameter | Description | Example |
start |
Specifies which page the offset will start from. By default, this value will be 0. | start=5 |
limit |
Specifies the number of schedules returned. By default, this value will be 100. | limit=20 |
Request
The following request will retrieve the last ten schedules posted within your organization.
| code language-shell |
|---|
|
Response
A successful response returns HTTP status 200 with a list of schedules for the specified organization as JSON.
| code language-json |
|---|
|
| table 0-row-2 1-row-2 2-row-2 3-row-2 4-row-2 5-row-2 6-row-2 7-row-2 8-row-2 9-row-2 10-row-2 11-row-2 12-row-2 13-row-2 14-row-2 15-row-2 | |
|---|---|
| Property | Description |
_page.totalCount |
The total number of schedules returned. |
_page.pageSize |
The size of the page of schedules. |
children.id |
The ID of the schedule. |
children.imsOrgId |
The organization ID of the schedule. |
children.sandbox |
An object containing sandbox information for the schedule. |
children.name |
The name of the schedule as a string. |
children.state |
A string containing the schedule state. The two supported states are “active” and “inactive”. By default, the state is set to “inactive”. |
children.type |
The type of job as a string. The two supported types are batch_segmentation and export. |
children.schedule |
A string containing the job schedule. Jobs can only be scheduled to run once a day, meaning you cannot schedule a job to run more than once during a 24-hour period. For more information about cron schedules, please read the appendix on the cron expression format. In this example, “0 0 1 * *” means that this schedule will run at 1AM every day. |
children.frequency |
The frequency that the schedule runs. Possible values include daily, weekly, monthly, and yearly. |
children.properties |
An object containing additional properties related to the schedule. |
children.properties.segments |
The IDs of the segment definitions that belong to the schedule. |
children.owner |
The owner of the schedule. Possible values include user if the schedule is user-created and system if the schedule is system-created. |
children.createEpoch |
The epoch creation time for the schedule in seconds. |
children.updateEpoch |
The epoch time the schedule was last updated in seconds. |
Create a new schedule create
You can create a new schedule by making a POST request to the /config/schedules endpoint.
API format
POST /config/schedules
Request
| code language-shell |
|---|
|
| table 0-row-2 1-row-2 2-row-2 3-row-2 4-row-2 5-row-2 6-row-2 | |
|---|---|
| Property | Description |
name |
Required. The name of the schedule as a string. |
type |
Required. The type of job as a string. The two supported types are batch_segmentation and export. |
properties |
Required. An object containing additional properties related to the schedule. |
properties.segments |
Required when type equals “batch_segmentation”. The IDs of the segment definitions you want to include as part of the schedule. |
schedule |
Required. A string containing the job schedule. Jobs can only be scheduled to run once a day, meaning you cannot schedule a job to run more than once during a 24-hour period. The job schedule will determine the schedule’s frequency. For more information about cron schedules, please read the appendix on the cron expression format. In this example, “0 0 1 * *” means that this schedule will run at 1AM every day. |
state |
Optional. A string containing the schedule state. The two supported states are active and inactive. By default, the state is set to inactive. |
Response
A successful response returns HTTP status 200 with details of your newly created schedule.
| code language-json |
|---|
|
| table 0-row-2 1-row-2 2-row-2 3-row-2 4-row-2 5-row-2 6-row-2 7-row-2 8-row-2 9-row-2 10-row-2 11-row-2 12-row-2 13-row-2 14-row-2 15-row-2 16-row-2 | |
|---|---|
| Property | Description |
id |
The ID of the newly created schedule. |
imsOrgId |
The organization ID of the user who created the schedule. |
sandbox |
An object that contains the sandbox information for the schedule. For more information about sandboxes, read the sandboxes overview. |
sandbox.sandboxId |
The ID of the sandbox that contains your schedule. |
sandbox.sandboxName |
The name of the sandbox that contains your schedule. |
sandbox.type |
The sandbox’s type. Possible values include production and development. |
sandbox.default |
A boolean that shows whether or not the sandbox is the default sandbox. |
name |
The name that you gave to the schedule. |
state |
The state of the schedule. Possible values include active and inactive. If you didn’t set this as part of the request body, the state will be set to inactive. |
type |
The type of job for the schedule. Possible values include batch_segmentation and export. |
schedule |
The cron expression that represents when your schedule runs. For more information about creating cron expressions, read the the cron expression format section. |
frequency |
The frequency in which the schedule runs. This is directly dependent on the schedule’s cron expression. Possible values include daily, weekly, monthly, and yearly. |
properties |
An object that contains the segment definition IDs for the schedule, if the schedule is of batch_segmentation type. |
owner |
The type of entity that owns the schedule. Since you created the schedule, this value is user. |
createEpoch |
The epoch creation time for the schedule in seconds. |
updateEpoch |
The epoch time the schedule was last updated in seconds. |
Retrieve a specific schedule get
You can retrieve detailed information about a specific schedule by making a GET request to the /config/schedules endpoint and providing the ID of the schedule you wish to retrieve in the request path.
API format
GET /config/schedules/{SCHEDULE_ID}
{SCHEDULE_ID}id value of the schedule you want to retrieve.Request
| code language-shell |
|---|
|
Response
A successful response returns HTTP status 200 with detailed information about the specified schedule.
| code language-json |
|---|
|
| table 0-row-2 1-row-2 2-row-2 3-row-2 4-row-2 5-row-2 6-row-2 7-row-2 8-row-2 9-row-2 10-row-2 11-row-2 12-row-2 13-row-2 14-row-2 15-row-2 16-row-2 17-row-2 | |
|---|---|
| Property | Description |
id |
The ID of the schedule. |
imsOrgId |
The ID of the organization the schedule belongs to. |
sandbox |
An object that contains the sandbox information for the schedule. For more information about sandboxes, read the sandboxes overview. |
sandbox.sandboxId |
The ID of the sandbox that contains your schedule. |
sandbox.sandboxName |
The name of the sandbox that contains your schedule. |
sandbox.type |
The sandbox’s type. Possible values include production and development. |
sandbox.default |
A boolean that shows whether or not the sandbox is the default sandbox. |
name |
The name of the schedule as a string. |
state |
A string containing the schedule state. The two supported states are active and inactive. By default, the state is set to inactive. |
type |
The type of job as a string. The two supported types are batch_segmentation and export. |
schedule |
A string containing the job schedule. Jobs can only be scheduled to run once a day, meaning you cannot schedule a job to run more than once during a 24 hour period. For more information about cron schedules, please read the appendix on the cron expression format. In this example, “0 0 1 * *” means that this schedule will run at 1AM every day. |
frequency |
The frequency that the schedule runs. This value is directly dependent on the schedule’s cron expression. Possible values include daily, weekly, monthly, and yearly. |
properties |
An object containing additional properties related to the schedule. |
properties.segments |
The list of segment definition IDs that are part of the schedule. |
owner |
The type of entity that owns the schedule. If a user created the schedule, this value is user. If the schedule was a system-created schedule, this value is system. |
createEpoch |
The epoch creation time for the schedule in seconds. |
updateEpoch |
The epoch time the schedule was last updated in seconds. |
Update details for a specific schedule update
You can update a specific schedule by making a PATCH request to the /config/schedules endpoint and providing the ID of the schedule you are trying to update in the request path.
The PATCH request allows you to update either the state or the cron schedule for an individual schedule.
API format
PATCH /config/schedules/{SCHEDULE_ID}
{SCHEDULE_ID}id value of the schedule you want to update.You can use a JSON Patch operation to update the state of the schedule. To update the state, you declare the path property as /state and set the value to either active or inactive. For more information about JSON Patch, please read the JSON Patch documentation.
Request
| accordion | ||
|---|---|---|
| A sample request to update the schedule state. | ||
|
| table 0-row-2 1-row-2 2-row-2 | |
|---|---|
| Property | Description |
path |
The path of the value you want to patch. In this case, since you are updating the schedule’s state, you need to set the value of path to “/state”. |
value |
The updated value of the schedule’s state. This value can either be set as “active” or “inactive” to activate or deactivate the schedule. Please note that you cannot disable a schedule if the organization has been enabled for streaming. |
Response
A successful response returns HTTP status 204 (No Content).
path property as /schedule and set the value to a valid cron schedule. For more information about JSON Patch, please read the JSON Patch documentation. For more information about cron schedules, please read the appendix on the cron expression format.Request
| code language-shell |
|---|
|
| table 0-row-2 1-row-2 2-row-2 | |
|---|---|
| Property | Description |
path |
The path of the value you want to updated. In this case, since you are updating the cron schedule, you need to set the value of path to /schedule. |
value |
The updated value of the cron schedule. This value needs to be in the form of a cron schedule. In this example, the schedule will run on the second of every month. |
Response
A successful response returns HTTP status 204 (No Content).
Delete a specific schedule
You can request to delete a specific schedule by making a DELETE request to the /config/schedules endpoint and providing the ID of the schedule you wish to delete in the request path.
API format
DELETE /config/schedules/{SCHEDULE_ID}
{SCHEDULE_ID}id value of the schedule you want to delete.Request
| code language-shell |
|---|
|
Response
A successful response returns HTTP status 204 (No Content).
Add audiences to schedule add-audiences
You can add audiences to a specific schedule by making a POST request to the /config/schedules/add-audiences endpoint.
API format
POST /config/schedules/add-audiences
Request
| code language-shell |
|---|
|
idsegmentsResponse
A successful response returns HTTP status 200 with detailed information of the operation.
| code language-json |
|---|
|
| table 0-row-2 1-row-2 2-row-2 3-row-2 4-row-2 | |
|---|---|
| Property | Description |
added |
An array containing the IDs of the segment definitions that were added to the schedule. |
existing |
An array containing the IDs of the segment definitions that already were on the schedule. |
invalid |
An array containing invalid segment definition IDs that were part of the request body. |
segmentCount |
An object that contains the number of segment definitions that were previously part of the schedule (previous), the number of segment definitions that are now part of the schedule (current), and the difference between those two values (diff). |
Remove audiences from schedule remove-audiences
You can remove audiences from a specific schedule by making a POST request to the /config/schedules/remove-audiences endpoint.
API format
POST /config/schedules/remove-audiences
Request
| code language-shell |
|---|
|
idsegmentsResponse
A successful response returns HTTP status 200 with detailed information of the operation.
| code language-json |
|---|
|
| table 0-row-2 1-row-2 2-row-2 3-row-2 | |
|---|---|
| Property | Description |
removed |
An array containing the IDs of the segment definitions that were removed from the schedule. |
notFound |
An array containing the IDs of segment definitions that could not be found within the schedule. |
segmentCount |
An object that contains the number of segment definitions that were previously part of the schedule (previous), the number of segment definitions that are now part of the schedule (current), and the difference between those two values (diff). |
Get audience map get-audience-map
You can get the audience map of your audiences by making a POST request to the /config/schedules/audience-map endpoint. The audience map represents a mapping between the segment definition IDs and the schedules those IDs belong to.
API format
POST /config/schedules/audience-map
Request
| code language-shell |
|---|
|
segmentsResponse
A successful response returns HTTP status 200 with detailed information about the audience and schedule mapping.
| code language-json |
|---|
|
| table 0-row-2 1-row-2 2-row-2 | |
|---|---|
| Property | Description |
audienceMap |
A mapping of segment definition IDs with the schedules they belong to. |
schedules |
An object that contains information about the schedules that are listed within the audience map. |
Trigger schedule job trigger
You can manually trigger a schedule to activate by making a POST request to the /config/schedules/trigger endpoint.
API format
POST /config/schedules/trigger
Request
| code language-shell |
|---|
|
idResponse
A successful response returns HTTP status 200 with no content.
Next steps
After reading this guide you now have a better understanding of how schedules work.
Appendix appendix
The following appendix explains the format of cron expressions used in schedules.
Format
A cron expression is a string that is made up of 6 or 7 fields. The expression would look something similar to the following:
0 0 12 * * ?
In a cron expression string, the first field represents the seconds, the second field represents the minutes, the third field represents the hours, the fourth field represents the day of the month, the fifth field represents the month, and the sixth field represents the day of the week. You can also optionally include a seventh field, which represents the year.
, - * /, - * /, - * /, - * ? / L W, - * /, - * ? / L #, - * /SUN is equivalent to using sun.The special characters allowed represent the following meanings:
** in the hours field would mean every hour.?3 in the day of the month field and ? in the day of the week field.-9-15 in the hours field, this would mean the hours would include 9, 10, 11, 12, 13, 14, and 15.,MON, FRI, SAT in the day of the week field, this would mean the days of the week would include Monday, Friday, and Saturday.// determines where it increments from, while the value placed after the / determines how much it increments by. For example, if you put 1/7 in the minutes field, this would mean that the minutes would include 1, 8, 15, 22, 29, 36, 43, 50, and 57.LLast, and has a different meaning depending on which field it is used by. If it is used with the day of the month field, it represents the last day of the month. If it is used with the day of the week field by itself, it represents the last day of the week, which is Saturday (SAT). If it is used with the day of the week field, in conjunction with another value, it represents the last day of that type for the month. For example, if you put 5L in the day of the week field, it would only include the last Friday of the month.W18W in the day of the month field, and the 18th of that month was a Saturday, it would trigger on Friday the 17th, which is the closest weekday. If the 18th of that month was a Sunday, it would trigger on Monday the 19th, which is the closest weekday. Please note that if you put 1W in the day of the month field, and the closest weekday would be in the previous month, the event will still trigger on the closest weekday of the current month.Additionally, you can combine
L and W to make LW, which would specify the last weekday of the month.## represents the day of the week, while the value placed after the # represents which occurrence in the month it is. For example, if you put 1#3, the event would trigger on the third Sunday of the month. Please note that if you put X#5 and there is no fifth occurrence of that day of the week in that month, the event will not be triggered. For example, if you put 1#5, and there is no fifth Sunday in that month, the event will not be triggered.Examples
The following table shows sample cron expression strings and explains what they mean.
0 0 13 * * ?0 30 9 * * ? 20220 * 18 * * ?0 0/10 17 * * ?0 13,38 5 ? 6 WED0 30 12 ? * 4#30 30 12 ? * 6L0 45 11 ? * MON-THU