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 Schedule
POST /api/v1/schedules/

Updating a Schedule
PUT /api/v1/schedules/[SCHEDULE ID]/ or POST /api/v1/schedules/[SCHEDULE ID]/

Required fields:

reportThe report ID.
nameAn optional name for the report.
schedule_typeThe type of schedule: Once, Daily, Weekly, Monthly, Quaterly. ( Possible values: O | D | W | M | Q )
scheduled_time_hourHour of schedule ( Possible values: "00"-"23" )
scheduled_time_minuteMinute of schedule ( Possible values: "00" | "15" | "30" | "45" )
export_typeDocument export type PDF or PNG (not required if it is an email). ( Possible values: pdf | png )
export_data_typeData export type CSV or Excel (not required if it is an email or document export type selected). ( Possible values: csv | xlsx )
method_typeMethod of delivery: Email or Slack ( Possible values: email | slack )
timezoneString for the timezone used in the schedule (for a list of possible values see the selector here).
schedule_conditionIf the schedule is conditional or not ( Possible values: "1" - Non-conditional | "2" - Conditional ). Type: String.
retry_conditionHow 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_weekA 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_monthScheduled day of the month ( Possible values: 1-29 | 29th means last day of the month) Type: Integer.
usersA list of User IDs (e.g. [2,3]). Type: List of Integers.
groupsA list of Group IDs (e.g. [5,6]). Type: List of Integers.
trigger_valueTrigger value. Type: String.
queryQuery for the condition. Type: String.
datasourceThe 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]
            }'