Creating/Updating a Schedule
The schedule creation and update endpoints allow you to programmatically create new schedules or modify existing ones. You can specify schedule types (Once, Daily, Weekly, Monthly, Quarterly), set delivery times, choose export formats (PDF, PNG, CSV, Excel), configure delivery methods (Email, Slack), and set up conditional scheduling. All schedules require a report ID, timing parameters, and delivery method configuration. Optional parameters allow you to specify recipients through user or group IDs and set up conditional triggers.
Creating a SchedulePOST /api/v1/schedules/
Updating a SchedulePUT /api/v1/schedules/[SCHEDULE ID]/
or
POST /api/v1/schedules/[SCHEDULE ID]/
Required fields:
report | The report ID. |
name | An optional name for the report. |
schedule_type | The type of schedule: Once, Daily, Weekly, Monthly, Quaterly. ( Possible values: O | D | W | M | Q ) |
scheduled_time_hour | Hour of schedule ( Possible values: "00"-"23" ) |
scheduled_time_minute | Minute of schedule ( Possible values: "00" | "15" | "30" | "45" ) |
export_type | Document export type PDF or PNG (not required if it is an email). ( Possible values: pdf | png ) |
export_data_type | Data export type CSV or Excel (not required if it is an email or document export type selected). ( Possible values: csv | xlsx ) |
method_type | Method of delivery: Email or Slack ( Possible values: email | slack ) |
timezone | String for the timezone used in the schedule (for a list of possible values see the selector here). |
schedule_condition | If the schedule is conditional or not ( Possible values: "1" - Non-conditional | "2" - Conditional ). Type: String. |
retry_condition | How long should the schedule be retried if it fails its condition ( Possible values: "0" - No retries | "1" - 15 minutes | "2" - 30 minutes | "3" - 1 hour | "4" - 2 hours | "5" - 6 hours ). Type: String. |
Optional fields:
scheduled_day_of_week | A list of days in the week (e.g [0,1]) ( Possible values: 0 - Monday| 1 - Tuesday | 2 - Wednesday | 3 - Thursday | 4 - Friday | 6 - Saturday | 6 - Sunday ) Type: List of Integers. |
scheduled_day_of_month | Scheduled day of the month ( Possible values: 1-29 | 29th means last day of the month) Type: Integer. |
users | A list of User IDs (e.g. [2,3]). Type: List of Integers. |
groups | A list of Group IDs (e.g. [5,6]). Type: List of Integers. |
trigger_value | Trigger value. Type: String. |
query | Query for the condition. Type: String. |
datasource | The ID for the datasource. You can find the IDs for datasources here. Type: Integer |
Creating a schedule example
curl 'https://acmeinc.datareportive.com/api/v1/schedules/' \
-X POST \
-H 'Authorization: Token [ TOKEN ]' \
-H 'Content-Type: application/json' \
-d '{
"report": 167,
"schedule_type": "W",
"scheduled_time_hour": "15",
"scheduled_time_minute": "15",
"method_type":"email",
"timezone":"Europe/London",
"schedule_condition":"1",
"retry_condition":"1",
"users":[24,22],
"export_type":"pdf",
"scheduled_day_of_week":[1,2]
}'