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
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.
How to Install the CRD API?
- Go to Options.
- Go to REST API.
- The API Settings section is used for collaboration and other system functions.
- Click Install API.
- Enter your windows credentials to install the API.
- Click OK.
- Click Yes.
- Click OK.
- The CRD API is installed.
- Click Start to start the CRD API Service.
- The CRD API is configured and CRD API Service is running.
API Clients
- The API Clients section is used to give another application access to the CRD API.
- Click Add.
- You only need to provide the Client name as the Client ID and Secret are automatically generated by CRD.
- Once the Client name is added, click Save & Close.
How do I use the CRD API?
Getting Started
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.
You can also create multiple SSRS single schedules using the API so that a JSON file can be picked with their definitions.
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:
int i
IsSchedulerRunning
To check if the CRD scheduler is running:
GET /api/service/isschedulerrunning
Result:
{
bool Result
}
StartScheduler
Result:
GET /api/service/startscheduler
Result:
Ok 200
StopScheduler
Result:
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.
SingleSchedule Endpoint
The SingleSchedule endpoint allows you to carry out CRUD operations related to CRD single schedules.
* denotes a required field.
Create
This is to create single schedules.
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. |