The CRD API is used for collaboration and other system functions. CRD API allows you to run schedules as well as control the scheduling services. Here is how to install and configure it if needed.
Options - CRD API
The CRD API enables you to manage and execute schedules effectively, along with offering control over scheduling services. It is versatile, allowing you to interact with the API using any programming language you prefer.
The CRD API is a RESTful API that utilizes HTTP requests and JSON responses. To quickly get started with the CRD API, we recommend using Postman—a user-friendly, free tool that aids developers in executing and troubleshooting API requests. Postman serves as the definitive reference for this documentation.
How to Install the CRD API?
Step 1 - Navigate to Options.
- The API Settings section is used for collaboration and other system functions.
Step 3 - Click Install API.
Step 4 - Enter your windows credentials to install the API.
Step 5 - Click OK.
Step 6 - Click Yes.
Step 7 - Click OK. The CRD API has been successfully installed.
Step 8 - Click Start to start the CRD API Service.
API Clients
This section is used to give another application access to the CRD API.
Step 1 - Click Add.
- You only need to provide the Client name as the Client ID and Secret are automatically generated by CRD.
How do I use the CRD API?
Getting Started
This documentation is designed for readers who possess a fundamental understanding of API functionality and are familiar with API testing tools like Postman.
CRD's API allows you to run schedules as well as control the scheduling services. You can use any programming language of your choice to query the API.
The CRD API is a RESTful API based on HTTP requests and JSON responses. The easiest way to start using the CRD API is by using Postman, a free tool which helps developers run and debug API requests, and is the source of truth for this documentation.
Unless otherwise specified, all requests must be made with the Content-Type set to application/x-www-form-urlencoded in the request header.
Authentication and Authorization
The CRD API can use OAuth2 Client Credentials or Username and Password authentication and authorization flow. All API endpoints except the /api/service/ping require a valid access token for authorization.
Get Token
Username and Password Flow
To request an access token using the credentials of a CRD user, make a POST request as follows:
http://[crdserver]:9000/login/token
POST http://[crdserver]:9000/login/token
POST Body
string username
string password
Example Result
{
"UserId": "jd",
"FirstName": "John",
"LastName": "Doe",
"role": "Administrator",
"ExpiryDateEpoch": 1617803400,
"token": "VEw+8f/9N1D8ZiJOmOses38Wad0RD/NU9jUDIVVK8CeUcmIjErSZDn965NVmSlEZJd3gfRbkUajd5dCNm87c295S1TO4RKbeJUho6t6XEJUdiJSs1T4WY2xEaR75RqufM3Xi3u55Pp3AsQX0jmN0wcOe/26k1y3feM8hZmnjffbDYZT7azIpiebLBPaXhY6dAA==",
"token_type": "custom"
}
Client Credentials Flow
In order to obtain an access token, you must first add the Client application to CRD. This is done under the Configuration/CRD API screen.
You only need to provide the Client name as the Client ID and Secret are automatically generated by CRD.
To request an access token, make a POST request as follows:
http://[crdserver]:9000/oauth2/token
POST http://[crdserver]:9000/oauth2/token
POST Body
string grant_type: client_credentials
string client_id
string client_secret
Result
{
string access_token
string token_type: bearer
int expires_in
}
Below is an example of what a successful authentication result looks like:
{
"access_token": "AQAAANCMnd8BFdERjHoAwE_...",
"token_type": "bearer",
"expires_in": 86399
}
CRD API tokens expire in 24 hours.
Once the access token has been obtained, it must be included as part of your API request headers.
For the username and password flow, the request header must include:
Authorization: token {access_token}
For client credentials flow include:
Authorization: bearer {access_token}
EndPoints
The API is accessed by making HTTP requests to a specific URL endpoint, in which GET or POST variables contain information about what you wish to access. Every endpoint is accessed via the port and protocol configured in CRD. The CRD API Service must also be running on the CRD server.
The default starting endpoint for the API is:
http://[crdserver]:9000/api
Service EndPoint
The Service Endpoint allows you to query and control the CRD services.
Ping
To check if the API is up and running, you can use Ping. The call will return 1 when the API is running.
GET /api/service/ping
Result:
The call will return 1 when the API is running or a 0 if it is not.
int 1
IsSchedulerRunning
To check if the CRD scheduler is running:
GET /api/service/isschedulerrunning
Result:
True if the CRD Scheduler is running
False if the CRD Scheduler is not running.
{
true
}
StartScheduler
To start the CRD Scheduler:
If you are using client credentials you will need to use the Authorization type of Bearer Token before entering the API call,.
GET /api/service/startscheduler
Result:
Ok 200
StopScheduler
To Stop the CRD Scheduler:
GET /api/service/stopscheduler
Result:
Ok 200
GetConfigPath
To get the path to the CRD config file:
GET /api/service/getconfigpath
Result:
{
string Result
}
Schedule Endpoint
The Schedule endpoint allows you to control CRD schedules. Where a schedule type must be specified, the following are valid:
-
"report" or “single”: all Single and Data-Driven Schedules
-
"automation": all Automation schedules
-
"package": all Single and Data-Driven Package schedules
-
"event": all Event-Based schedules
-
“event-package" or “eventpackage”: all Event-Based Package schedules
The schedule’s unique Id can be obtained from the schedule’s properties screen in the application GUI.
ExecuteSchedule
Synchronously kicks off a schedule and waits for its completion.
POST api/schedule/executeschedule
POST Body
string ScheduleType
int UniqueId
string RunBy
Result
The result will be true or false. If the Schedule failed to execute there should be an error message and error number displayed.
{
bool Result
string ErrorMessage
int ErrorNumber
}
ExecuteScheduleOnTimeAsync
Asynchronously kicks off the schedule as if it is being run by the scheduler. At completion, the schedule’s NextRun date will be incremented.
POST api/schedule/executescheduleontimeasync
POST Body
string ScheduleType
int UniqueId
string RunBy
Result
{
string ExecutionId
}
ExecuteScheduleAsync
Asynchronously kicks off a schedule and does not wait for its completion. The resulting ExecutionId can be used to query the execution status
POST api/schedule/executescheduleasync
POST Body
string ScheduleType
int UniqueId
string RunBy
Result
{
string ExecutionId
SingleSchedule Endpoint
The SingleSchedule endpoint provides the functionality to perform Create, Read, Update, and Delete (CRUD) operations for managing CRD single schedules efficiently.
If you are using client credentials you will need to use the Authorization type of Bearer Token before entering the API call,.
Create
Creating Single Schedules
* denotes a required field.
POST api/schedule/CreateSingleReport
Dependent Models
RenderingSettingsModel
Field |
Type |
Description |
---|---|---|
MinLoadingTime |
int |
The minimum amount of time that CRD will wait before proceeding to render a crystal report to file. |
MaxLoadingTime |
int |
The maximum amount of time that CRD will wait before proceeding to render a Crystal report to file. |
PageWidth |
int |
The width of the Crystal report. |
PageHeight |
int |
The height of the Crystal report. |
PageOrientation |
int |
The orientation of the crystal report. Valid values are:
|
PagesToRender |
string |
The range of pages to render e.g. 1,2,3,5-10. Leave blank for all pages. |
MarginLeft |
int |
The page’s left side margin. |
MarginRight |
int |
The page’s right side margin. |
ViewStyle |
int |
The Crystal report fit style. Valid values are:
|
RenderingMethod |
int |
The method to use for rendering the Crystal report. Valid values are:
|
TransparentBackground |
boolean |
Indicates whether the rendered report should include the background image. |
MinReportSize |
int |
An optional size that CRD will use to determine whether or not a report was rendered successfully. If the report output size is less than this value, then the report will be re-rendered. |
CropPdf |
boolean |
Indicates if CRD should crop the PDF output. |
CropLeft |
int |
The mount of pixels to crop the PDF by from the left edge. |
CropRight |
int |
The mount of pixels to crop the PDF by from the right edge. |
CropTop |
int |
The mount of pixels to crop the PDF by from the top edge. |
CropBottom |
int |
The mount of pixels to crop the PDF by from the bottom edge. |
PDFCompression |
int |
How much compression to apply to the rendered PDF. Valid values are:
|
BasicFilterModel
This model inherits from the FilterBaseModel.
Field |
Type |
Description |
---|---|---|
BasicValues |
[string] |
An array of one or more values for the filter. |
Operator |
string |
The basic filter operator. Value can be either “In” or “NotIn”. Default value is “In”. |
AdvancedFilterModel
This model inherits from the FilterBaseModel.
Field |
Type |
Description |
---|---|---|
Operator |
string |
The filter operator. Valid values are:
|
FirstCondition |
key-value pair of string and string |
A key-value pair of the operator and the value for the advanced filter condition. |
SecondCondition |
key-value pair of string and string |
A dictionary of the operator and the value for the advanced filter condition. |
TimeScheduleBaseModel
Field |
Type |
Description |
---|---|---|
Description |
string |
The schedule’s description. |
Enabled |
boolean |
Indicates if the schedule should be enabled. |
EndDate |
string |
If applicable the schedule’s end date in the format yyyy-MM-dd. |
ExecutionTime |
string |
The schedule’s execution time in the format HH:mm e.g. 14:00 for 2PM. |
Frequency |
string |
The frequency of the schedule. Valid values are:
|
HasEndDate |
boolean |
Indicates if the schedule has an end date. |
Keywords |
string |
The schedule’s keywords. |
NextRunEpochUtc |
readonly int |
The schedule’s next run date represented as Unix date. |
Repeat |
bool |
Indicates if the schedule should repeat after the execution time. |
RepeatInterval |
double |
The repetition interval. |
RepeatUnit |
string |
The repeat interval. Valid values are:
|
RepeatUntil |
string |
When the schedule will repeat until in the format HH:mm. |
StartDate |
string |
The start date of the schedule in the format yyyy-MM-dd e.g. 2021-04-07 for April 7th 2021. |
DataDriverModel
Field |
Type |
Description |
---|---|---|
KeyField* |
string |
The name of the field that uniquely identifies each record in the data-driver. |
ValuesJson* |
string |
A valid JSON string representing the multiple objects to be used to data-drive the schedule. |