REST — SchedulesV2
Viewing, creating, modifying, and deleting schedules via the REST Web Service API is available in Exago v2021.1.1+. This feature requires Installing the Scheduler Service.
All requests require a Session Id URL parameter and basic request headers. In the following topic, headers are omitted in the interest of brevity.
Schedule JSON
A schedule is represented as a JSON object with the following properties:
Name | Type | Writable | Description |
---|---|---|---|
JobId | string | no | A GUID which uniquely identifies this schedule in the application. |
ScheduleName | string | required-create | The descriptive name of the schedule. |
ReportName | string | required-create | The name of the report being scheduled including the relative folder path. |
Status | string from ScheduleJobStatus | no | JobStatus v2019.2+ The read-only current status of the schedule. |
ExportType | string from ScheduleExportType | yes | ScheduleExportType v2019.2+ The file type of the created report when the schedule runs. |
Password | string | yes | The PDF or Excel output file password in plain-text. |
IsArchive | Boolean (false) | no | true if this schedule object represents an execution that was saved to disk as opposed to being emailed. false if this schedule object represents an execution that was emailed. |
JobType | string from ScheduleJobType | no | ScheduleJobType v2019.2+ The read-only type of job this schedule will perform. |
Recurrence | ScheduleRecurrence JSON | yes | A JSON object representing the schedule’s recurrence pattern (for example time, day and range of running). |
FilterValues | array of ScheduleCompositeFilter JSON | yes | An array of JSON objects representing the prompting filters to apply to the component reports of a composite report (Chained Report or Dashboard) |
Filters | array of ScheduleFilterItem JSON | yes | An array of JSON objects representing the prompting filters to apply to the report in this schedule, if the ReportName refers to a report that is not a Chained Report or Dashboard. |
Parameters | array of ScheduleParameter JSON | yes | An array of JSON objects representing the parameters for this schedule. |
Batch | ScheduleBatchInfo JSON | yes | A JSON object representing the batch processing information. |
Recipients | ScheduleRecipientInfo JSON | yes | A JSON object representing the email recipients of this schedule’s report. |
ParentJobId v2021.1.15+ | string | no | The GUID of the scheduler job that created this one. A scheduled job that recurs 4 times will ultimately create 5 job files—1 for the original schedule, and one for each of the 4 executions of the schedule. This field holds the GUID of the original schedule. If this field is an empty string, then it is a parent job. |
Schedule Example
This example represents a schedule named Report Totals which will run a report named Employee Orders from the My Reports folder. When it runs, a PDF file with the password “abcd” will be generated an attached to an email sent to peter@mycompany.com.This schedule will run every hour starting at 9:00 AM until 5:00 PM every day of the week from March 1, 2021–June 1, 2021.
{ "JobId":"4c835b79-56e3-4051-a0c3-6d21d9576bbc", "JobType":"Report", "ScheduleName":"Report Totals", "ReportName":"My ReportsEmployee Orders", "ReportId":"9b5d7d7f-53fe-4db3-8914-c5c3fad9fb70", "Status":"Ready", "ExportType":"Pdf", "Password":"abcd", "IsArchive":false, "Recurrence":{ "IsImmediate":false, "RecurrenceType":"Daily", "RecurrenceRange":"EndByDate", "ScheduleTime":"09:00", "RepeatEvery":true, "RepeatEveryHours":1, "RepeatEveryMinutes":0, "RepeatEveryEndTime":"17:00", "RangeStartDate":"2021-03-01", "RangeEndDate":"2021-06-01", "OccurrencesToEnd":1, "RecurrencePattern":{ "Once":null, "Daily":{ "IsEveryWeekday":true, "DailyNumberOfDaysInterval":0 }, "Weekly":null, "Monthly":null, "Yearly":null } }, "Filters":null, "FilterValues":null, "Parameters":[ ], "Batch":null, "Recipients":{ "EmailResults":true, "AttachOutputToEmail":true, "ToAddresses":[ "peter@mycompany.com" ], "CcAddresses":[ ], "BccAddresses":[ ], "ReplyToAddresses":[ ], "EmailSubject":"Hourly order update", "EmailBody":"Please find the hourly order update attached to this email." }, "ParentJobId":"9f0b39c0-3170-4ca1-ac21-e830356bf6fb" }
List All Schedules
List all of the schedules in the current configuration. Returns an array of ScheduleListItem JSON objects, each representing an individual schedule.
GET /rest/SchedulesV2
Create New Schedule
Create a new schedule. The ScheduleName and ReportName are required. Returns HTTP 201 Created with a Schedule object representing the new schedule.
POST /rest/SchedulesV2
Example
This example creates a new schedule named MyTestSchedule. This schedule will run a report named Products by Category from the ExpressViews folder 10 times, starting on October 17, 2019. The report will run at 2:45 PM only on weekdays. The output will be saved as a PDF file to a directory on the server’s file system.
{ "ScheduleName":"MyTestSchedule", "ReportName":"ExpressViewsProducts by Category", "ExportType":"Pdf", "Recurrence":{ "IsImmediate":false, "RecurrenceType":"Daily", "RecurrenceRange":"EndAfterNOccurences", "ScheduleTime":"14:45", "RepeatEvery":false, "RangeStartDate":"2019-10-17", "RangeEndDate":null, "OccurrencesToEnd":10, "RecurrencePattern":{ "Daily":{ "IsEveryWeekday":true, "DailyNumberOfDaysInterval":0 } } } }
Show a Schedule
Show the properties of the schedule specified by the scheduleID. Returns a Schedule object representing the schduleID requested.
GET /rest/SchedulesV2/{scheduleID}
Edit a Schedule
Edit the properties of the schedule specified by the scheduleID. Include only those properties to be updated. Returns no JSON objects but will return HTTP status code 204 to indicate success.
PATCH /rest/SchedulesV2/{scheduleID}
Example
This example changes the ExportType of the schedule with ID aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee
to be RTF.
PATCH /schedulesv2/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee
{
"ExportType": "Rtf"
}
Delete a Schedule
If the specified schedule is active (that is, it is not Completed or Deleted) it will be set to Deleted status. If the specified schedule is inactive, it will be flushed from the scheduler. Therefore, two calls must be made or a separate call to flush the scheduler must be made if the schedule was active when it deleted and the intention is to flush it. Returns no JSON objects but will return HTTP status code 204 to indicate success.
DELETE/rest/SchedulesV2/{scheduleID}
Example
This example marks schedule with ID aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee
as Deleted.
DELETE /rest/SchedulesV2/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee
Flush the Scheduler
Flush the scheduler of all Completed and Deleted schedules. An array of ScheduleListItem will be returned with the resulting schedule list after the flush has occurred.
POST /rest/SchedulesV2/Flush
ScheduleListItem JSON
A JSON object which represents an item in the schedule list. An array of ScheduleListItem is returned when calling GET /SchedulesV2
Name | Type | Writable | Description |
---|---|---|---|
Id | string | no | The GUID which uniquely identifies this schedule. |
ParentJobId v2021.1.15+ | string | no | The GUID of the scheduler job that created this one. A scheduled job that recurs 4 times will ultimately create 5 job files—1 for the original schedule, and one for each of the 4 executions of the schedule. This field holds the GUID of the original schedule. If this field is an empty string, then it is a parent job. |
ScheduleName | string | no | The descriptive name of the schedule. The same as entering a Schedule Name into the Scheduled Report Wizard in the user interface |
Type | string from ScheduleRecurrenceType | no | ScheduleRecurrenceType v2019.2+ Indicates the type of recurrence this schedule has. |
ReportName | string | no | The name of the report being scheduled |
LastExecDate | string | no | The date and time of the most recent execution of this schedule, in UTC time as YYYY-MM-DDThh:mm:ssz format. If the schedule has never run, returns null. |
NextExecDate | string | no | The date and time of the next execution of this schedule, in UTC time as YYYY-MM-DDThh:mm:ssz format. If the schedule will not run again, returns null. |
Status | string from ScheduleJobStatus | no | JobStatus v2019.2+ The read-only current status of the schedule. |
RunCount | integer | no | The number of times this schedule has been executed. |
UserId | string | no | The value of the built-in @userId@ parameter when the schedule was created. |
CompanyId | string | no | The value of the built-in @companyId@ parameter when the schedule was created. |
JobType | string from ScheduleJobType | no | ScheduleJobType v2019.2+ The type of job that this schedule represents |
Example
This array contains one ScheduleListItem representing a daily recurring schedule that has already run once and will run again the following hour.
{ "Id":"4c835b79-56e3-4051-a0c3-6d21d9576bbc", "ParentJobId":"9f0b39c0-3170-4ca1-ac21-e830356bf6fb", "ScheduleName":"Report Totals", "Type":"Daily", "ReportName":"Employee Orders", "LastExecDate":"2021-02-12T21:46:37Z", "NextExecDate":"2021-02-12T22:00:00Z", "Status":"Ready", "RunCount":1, "UserId":"Fiona Light", "CompanyId":"Tip O' The Nose Services, LLC", "JobType":"Report" }
ScheduleRecurrence JSON
A JSON object representing a schedule recurrence pattern.
Name | Type | Writable | Description |
---|---|---|---|
IsImmediate | Boolean | yes (false) | Determines if the schedule will run immediately or not. If true the schedule runs immediately. Must be false in order to use the other recurrence properties. |
RecurrenceType | string from RecurrenceType | yes | RecurrenceType v2019.2+ The type of recurrence to use. |
RecurrenceRange | string from RecurrenceRange | yes | RecurrenceRange v2019.2+ Determines when the schedule’s recurrence pattern will end. |
ScheduleTime | string | required | The time at which the schedule should run. Must be formatted in hh:mm format utilizing a 24-hour clock. (for example 9:00 AM = 09:00 , 1:37 PM = 13:37 ) |
RepeatEvery | Boolean | yes (false) | If true, the schedule will repeat every RepeatEveryHours hours and RepeatEveryMinutes minutes until RepeatEveryEndTime. |
RepeatEveryHours | integer | yes | If RepeatEvery is true, the schedule will run every this number of hours. |
RepeatEveryMinutes | integer | yes | If RepeatEvery is true, the schedule will run every this number of minutes. |
RepeatEveryEndTime | string | yes | If RepeatEvery is true, the schedule will stop repeating at this time. Must be formatted in hh:mm format utilizing a 24-hour clock. (for example 9:00 AM = 09:00 , 1:37 PM = 13:37 ) |
RangeStartDate | string | yes | The date on which the schedule will start recurring, in yyyy-mm-dd format.
Set to {null} to clear an existing value when editing a schedule. |
RangeEndDate | string | yes | If RecurrenceRange is EndByDate, the schedule will stop recurring on this date, in yyyy-mm-dd format. |
OccurrencesToEnd | integer | yes | If RecurrenceRange is EndAfterNOccurences, the schedule will stop recurring after this many occurrences have run. |
RecurrencePattern | ScheduleRecurrencePattern JSON | yes | A JSON object representing the pattern that the recurrence should follow. |
ScheduleRecurrencePattern JSON
A JSON object representing a schedule recurrence pattern. The pattern selected here should match the RecurrenceType set in ScheduleRecurrence.
Pick one and only one of the properties.
Name | Type | Writable | Description |
---|---|---|---|
Once | OncePattern JSON | yes | A JSON object that represents a schedule that should run only once. |
Daily | DailyPattern JSON | yes | A JSON object that represents a schedule which will run on a daily basis. |
Weekly | WeeklyPattern JSON | yes | A JSON object that represents a schedule which will run on a weekly basis. |
Monthly | MonthlyPattern JSON | yes | A JSON object that represents a schedule which will run on a monthly basis. |
Yearly | YearlyPattern JSON | yes | A JSON object that represents a schedule which will run on a yearly basis. |
OncePattern JSON
A JSON object representing a schedule that does not recur, but runs only one time.
Name | Type | Writable | Description |
---|---|---|---|
OnceDate | string | required | The date on which the schedule shall run, in yyyy-mm-dd format. |
DailyPattern JSON
A JSON object representing a schedule recurrence pattern which occurs on a day-to-day basis
Name | Type | Writable | Description |
---|---|---|---|
IsEveryWeekday | Boolean | required | If true, the schedule runs every weekday, Monday–Friday. If False, set DailyNumberOfDaysInterval. |
DailyNumberOfDaysInterval | integer | yes | If IsEveryWeekday is false, the schedule will skip this number of days between executions.
For example, setting this value to 2 will result in a report executing on the 1st, 4th, 7th, etc… day of the month as there are two days between those dates. |
Example
This Daily recurrence pattern runs every weekday.
{ "IsEveryWeekday": true }
WeeklyPattern JSON
A JSON object representing a schedule recurrence pattern which occurs on a weekly basis.
Name | Type | Writable | Description |
---|---|---|---|
WeeklyNumberOfWeeksInterval | integer | required | The schedule will execute this number of weeks. |
WeeklyDaysOfWeek | array of Boolean | required | The schedule will run only on the days contained in the array, with the first element of the array representing Sunday, the second element representing Monday, and so on. The array must contain exactly seven Boolean values. Set the value to true to have the schedule run for that day, or false for it to skip that day. |
Example
In this example, the schedule will run every Sunday, Wednesday and Saturday of the week.
{ "WeeklyNumberOfWeeksInterval":"1", "WeeklyDaysOfWeek":[ true, false, false, true, false, false, true ] }
MonthlyPattern JSON
A JSON object representing a schedule recurrence pattern which occurs on a monthly basis.
Name | Type | Writable | Description |
---|---|---|---|
IsOnSpecificDayOfMonth | Boolean | yes | Determines whether a schedule will recur on a specific day of the month, or on a relative position in the month (for example third Monday of the month). Set to true for a specific day, or false for a relative day. |
MonthlySpecificDayNumber | integer | yes | If IsOnSpecificDayOfMonth is true, this is the calendar day of the month that the schedule will recur. Otherwise, null. |
MonthlySpecificEveryNMonths | integer | yes | If IsOnSpecificDayOfMonth is true, the monthly schedule will run every this number of months. Otherwise, null. |
MonthlyDayPosition | string | yes | If IsOnpecificDayOfMonth is false, the monthly recurrence will run on a relative position in the month. One and only one of the following values are accepted: first, second, third, fourth, last. Works in combination with MonthlyDayOfWeek. |
MonthlyDayOfWeek | string | yes | If IsOnSpecificDayOfMonth is false, the days on which the relative monthly recurrence occurs. One and only one of these values may be used: day, weekday, weekendday, sun, mon, tue, wed, thu, fri, sat. |
MonthlyRelativeEveryNMonths | integer | yes | If IsOnSpecificDayOfMonth is false, the schedule will recur every this number of months. |
Example
In this example, the schedule will run on the second Monday of every other month.
{ "IsOnSpecificDayOfMonth":false, "MonthlyDayPosition":"second", "MonthlyDayOfWeek":"mon", "MonthlyRelativeEveryNMonths":2 }
YearlyPattern JSON
A JSON object which represents a yearly schedule recurrence pattern.
Name | Type | Writable | Description |
---|---|---|---|
IsOnSpecificDayOfYear | Boolean | required | If true, the yearly schedule will recur on a specific day of the year. Use YearlySpecificMonth and YearlySpecficDayNumber to set the date. If false, the schedule will recur on a relative part of the year. Use YearlyRelativeDayPosition, YearlyRelativeDayOfWeek, YearlyRelativeMonth to select the relative day of recurrence. |
YearlySpecificMonth | integer | yes | If IsOnSpecificDayOfYear is true, this is the month portion of the date on which the schedule will recur.
Provide an integer representing the month of the calendar (1 = January, 2 = February … 12 = December) |
YearlySpecficDayNumber | integer (1) | yes | If IsOnSpecificDayOfYear is true, this is the day portion of the date on which the schedule will recur. Any positive integer 1–31 is accepted. |
YearlyRelativeWeekPosition | string | yes | If IsOnSpecificDayOfYear is false, this is the relative week in the month that this schedule will recur. One and only one of the following values are accepted: first, second, third, fourth, last. Works in combination with YearlyRelativeDayOfWeek and YearlyRelativeMonth. |
YearlyRelativeDayOfWeek | string | yes | If IsOnSpecificDayOfYear is false, this is the relative day of the week in the month that the schedule will recur. One and only one of these values may be used: day, weekday, weekendday, sun, mon, tue, wed, thu, fri, sat. |
YearlyRelativeMonth | string | yes | If IsOnSpecificDayOfYear is false, this is the number of the month in the year that the schedule will recur. (for example (1 = January, 2 = February … 12 = December)) |
Examples
This example will run the schedule every year on the last Sunday in September.
{ "IsOnSpecificDayOfYear":false, "YearlyRelativeDayPosition":"last", "YearlyRelativeDayOfWeek":"sun", "YearlyRelativeMonth":9 }
This example will run the schedule on April 15th of every year.
{ "IsOnSpecificDayOfYear":true, "YearlySpecificMonth":"April", "YearlySpecficDayNumber":15 }
ScheduleFilterItem JSON
A JSON object representing a group of one or more ScheduleFilterElement objects, defining the grouping of the prompting filters on a non-composite (ExpressView, Express, Advanced, CrossTab) report.
Name | Type | Writable | Description |
---|---|---|---|
Group | array of ScheduleFilterItem JSON | yes | The contents of a group of filters. If the filters are not grouped together, this value is null. |
Filter | array of ScheduleFilterElement JSON | yes | The filter statements contained in the group. |
ScheduleFilterElement JSON
A JSON object representing an individual filter on a non-composite (ExpressView, Express, Advanced, CrossTab) report.
Name | Type | Writable | Description |
---|---|---|---|
FilterText | string | yes | The field to be filtered, which can include applied formulas. This field must be one of the fields on the scheduled report. |
Operator | string from ScheduleFilterOperator | yes | ScheduleFilterOperator v2019.2+ The filter operator. |
AndFlag | Boolean | yes | If true, this filter will be logically ANDed with the next filter in the array. If false, this filter will be logically ORed with the next filter in the array. |
Values | array of number, string or Boolean | yes | The values to filter by. When using Operator.Between or Operator.NotBetween the array must contain exactly two values. When using Operator.OneOf or Operator.NotOneOf the array may contain any number of values. All other operators use only one value, which must still be in an array. Date and DateTimes must be represented as strings in yyyy-mm-dd format. |
Example
This Filters
array represents the following filter summary from the Advanced Report Designer: Work Order Tickets.Open Date > '05/14/2017' And (Work Order Tickets.Description Contains 'lightning' And Work Order Tickets.Description Contains 'RMA')
"Filters":[ { "Group":null, "Filter":{ "FilterText":"Work Order Tickets.Open Date", "Operator":"GreaterThan", "AndFlag":true, "Values":[ "2017-05-14 23:59:59.997" ] } }, { "Group":[ { "Group":null, "Filter":{ "FilterText":"Work Order Tickets.Description", "Operator":"Contains", "AndFlag":true, "Values":[ "lightning" ] } }, { "Group":null, "Filter":{ "FilterText":"Work Order Tickets.Description", "Operator":"Contains", "AndFlag":true, "Values":[ "RMA" ] } } ], "Filter":null } ]
ScheduleCompositeFilter JSON
A JSON object representing a prompting filter on a composite (Chained or Dashboard) report. ScheduleCompositeFilter objects appear in an array in the Schedule object’s FilterValues property.
Name | Type | Writable | Description |
---|---|---|---|
Reports | array of int | yes | An array of component report indices on a composite report (a Chained Report or Dashboard) that this filter applies to.
0 represents the first report, 1 represents the second report, and so on. |
FilterText | string | yes | The data field or formula that contains the data that will be filtered. It must be on all of the reports indicated by the Reports array. |
Operator | string from ScheduleFilterOperator | yes | ScheduleFilterOperator v2019.2+ The filter operator. |
AndFlag | Boolean | yes | If true, this filter will be logically ANDed with the next filter in the array. If false, this filter will be logically ORed with the next filter in the array. |
Values | array of number, string or Boolean | yes | The values to filter by. When using Operator.Between or Operator.NotBetween the array must contain exactly two values. When using Operator.OneOf or Operator.NotOneOf the array may contain any number of values. All other operators use only one value, which must still be in an array. Date and DateTimes must be represented as strings in yyyy-mm-dd format. |
Example
This Schedule JSON object excerpt is from a scheduled Chained Report with two reports in the chain. It’s Filters property is null, but the FilterValues property contains an array of ScheduleCompositeFilter JSON objects, one for each prompting filter. Note the Employees.Eid
applies to both reports in the chain.
"Filters":null, "FilterValues":[ { "Reports":[ 0 ], "FilterText":"=Year({Employees.HireDate})", "Operator":"EqualTo", "AndFlag":true, "Values":[ "2009" ] }, { "Reports":[ 0, 1 ], "FilterText":"Employees.EID", "Operator":"OneOf", "AndFlag":true, "Values":[ "4", "5", "6" ] }, { "Reports":[ 1 ], "FilterText":"=Year({Orders.OrderDate})", "Operator":"EqualTo", "AndFlag":true, "Values":[ "2016" ] } ],
ScheduleParameter JSON
A JSON object representing a prompting parameter on the scheduled report.
Name | Type | Writable | Description |
---|---|---|---|
Id | string | required | The Id (name) of the parameter on the scheduled report. To update the parameter’s value, the parameter with this Id must appear on the report being scheduled and must be prompting. |
Value | integer, string or date | yes | The value to set the parameter to, which is the same as setting the value of a prompting parameter when running a report. It does not change the underlying default parameter value.
For Boolean parameters, use 0 for false or 1 for true. |
DisplayValue | integer, string or date | yes | The value that is displayed in the report, if different than the Value.% |
Reports | array of integer | yes | An array of component report indices on a composite report (a Chained Report or Dashboard) that this parameter applies to.
0 represents the first report, 1 represents the second report, and so on. |
ScheduleBatchInfo JSON
A JSON object representing the information for processing individualized scheduled reports, also known as a batch report. The individualized reports will be emailed to recipients based on a Data Object field contained within BatchEmailEntityCategory > BatchEmailEntity > BatchEmailField. A summary of the batch report’s execution will be sent by email to ToAddresses and CC’ed to CcAddresses.
Example
This example sends a copy of the schedule’s execution summary to peter@mycompany.com, and sends the individualized executed report to each entry with an EmailAddress in the Employees data object.
{ "AttachReportToEmail":true, "ToAddresses":[ "peter@mycompany.com" ], "CcAddresses":[ ], "BatchEmailEntityCategory":"", "BatchEmailEntity":"Employees", "BatchEmailField":"EmailAddress" }
ScheduleRecipientInfo JSON
A JSON object representing an email to send when the schedule has run and to optionally attach the report to the email.
Example
This example attaches the report output file to an email and sends it to peter@mycompany.com and ryan@mycompany.comThe email is CCed to alex@mycompany.com and bailey@mycompany.com, and BCCed to rachel@mycompany.com. All email messages will have a subject line of “Here is the report you needed” and the message “Attached is the report you had asked for!” will appear in the body of the email.
{ "EmailResults":true, "AttachOutputToEmail":true, "ToAddresses":[ "peter@mycompany.com", "ryan@mycompany.com" ], "CcAddresses":[ "alex@mycompany.com", "bailey@mycompany.com" ], "BccAddresses":[ "rachel@mycompany.com" ], "ReplyToAddresses":[ ], "EmailSubject":"Here is that report you needed", "EmailBody":"Attached is the report you had asked for!" }