How to Create a New Schedule via API in Bold BI?
Overview
Creating a schedule for your dashboards in Bold BI is a straightforward process that can be done through the API. This article will guide you through the steps to set up a new schedule using the API.
API Endpoint for Creating a Schedule
To create a new schedule, you will need to send a POST request to the following API endpoint:
POST: http://localhost:55277/bi/api/site/site1/v4.0/dashboards/schedules
Please follow these steps to generate the access token for the above request: Access Token Generation API. Once the access token is generated, you need to pass it in the authorization header as follows: Authorization: Bearer <access token>
.
Sample Request Body
Below is a sample JSON request body to create a new schedule:
{
"Name": "YourScheduleName",
"ItemId": "YourDashboardId",
"ExportType": "Image",
"StartTime": "2024-02-10T15:04:40Z",
"NeverEnd": true,
"EndAfterOccurrence": 0,
"EndDate": "2024-02-11T15:04:40Z",
"UserList": ["user ID" or "UserEmail"],
"GroupList": ["Group ID"],
"ExternalRecipientsList": ["email@example.com"],
"ScheduleType": "Hourly",
"IsEnabled": true,
"FailureNotificationToOwner": true,
"FailureNotificationToRecipient": true,
"FailureOccurrence": 0,
"ExportFormatInfo": {
"ExportType": "Image",
"Extension": "jpg",
"Resolution": 96
},
"Email": {
"Subject": "Organization Name: Your scheduled dashboard",
"Body": "Hello Username,\n\nPlease find attached, the dashboard that you had requested.\n\nSchedule- ScheduleName has exported the dashboard [DashboardName](DashboardLink).\n\nRegards,\n\nOrganization Name"
},
"HourlySchedule": {
"ScheduleInterval": "0:15"
}
}
Replace YourScheduleName
, YourDashboardId
, email@example.com
, Organization Name
, Username
, ScheduleName
, DashboardName
, and DashboardLink
with your actual values.
Before creating the schedule via API, please make sure you have configured the SMTP settings in the server. Please refer to this link for more details: SMTP Configuration in Server.
Sample Response
Upon successful creation of the schedule, you will receive a response similar to the following:
{
"ScheduleName": "YourScheduleName",
"ScheduleId": "GeneratedScheduleId",
"StatusMessage": "Schedule was added Successfully",
"ScheduleType": "Hourly"
}
Additional Schedule Types
Besides hourly schedules, you can also create daily, weekly, monthly, and yearly schedules. Here are the additional properties you can include in your request body for different schedule types:
Daily Schedule
"DailySchedule": {
"RecurrenceType": "string",
"EveryNdays": 0,
"EveryWeekday": true
}
Weekly Schedule
"WeeklySchedule": {
"RecurrenceWeeks": 0,
"RecurrenceDays": ["string"]
}
Monthly Schedule
"MonthlySchedule": {
"RecurrenceType": "string",
"DayRecurrence": {
"DayInterval": 0,
"MonthInterval": 0
},
"CustomRecurrence": {
"WeekOfMonth": "string",
"DayOfWeek": "string",
"MonthInterval": 0
}
}
Yearly Schedule
"YearlySchedule": {
"YearInterval": 0,
"RecurrenceType": "string",
"MonthRecurrence": {
"MonthOfYear": "string",
"DayOfMonth": 0
},
"CustomRecurrence": {
"WeekOfMonth": "string",
"DayOfWeek": "string",
"MonthOfYear": "string"
}
}
Additional References
For more detailed information on the API and its capabilities, please refer to the following resources: