REST Methods
Login
Log in with a user account and password. The account should be a XLReporter user.
Description | |||
|---|---|---|---|
Request model | POST | ||
Default URL | http://localhost/xlrweb/api/login | ||
Body | Type | JSON (application / JSON) | |
Content | {
"username": "...",
"password": "..."
} | ||
Response | Type | JSON | |
Value | {
"endpoint": "login",
"success": true,
"error": 0,
"message": null
"data": [
{
"token": "xxx-xxx-xxx-xxx"
}
]
} | ||
The API returns a “token” which will be used for other methods. The token will expire due to inactivity.
Note that if http is used, the user credentials are transmitted in clear text.
Logout
To end a session, the client should log out.
Description | |||
|---|---|---|---|
Request model | POST | ||
Default URL | http://localhost/xlrweb/api/logout | ||
Body | Type | JSON (application / JSON) | |
Content | {
"token": "xxx-xxx-xxx-xxx"
} | ||
Response | Type | JSON | |
Value | {
"endpoint": "logout",
"success": true,
"error": 0,
"message": null,
"data": null
} | ||
Any login that becomes inactive will be logged out automatically.
Templates
Obtain an enumeration of the templates configured in XLReporter.
Description | |||
|---|---|---|---|
Request model | POST | ||
Default URL | http://localhost/xlrweb/api/templates | ||
Body | Type | JSON (application / JSON) | |
Content | {
"token": "xxx-xxx-xxx-xxx"
} | ||
Response | Type | JSON | |
Value | {
"endpoint":
"templates",
"success": true,
"error": 0,
"message": null
"data":
[
{
"name": "Batch Cycle",
"description": "…"
},
{
"name": "Product Routing",
"description": "…"
}
…
]
} | ||
The API returns each template with the following information:
name – name of the template
description – user defined description of the template
The list of templates returned include any template without parameters (e.g., a template that uses no variables) and any template configured with one or more instances. The name of these appear as Template|Instance (e.g., Process Trend Charts|Temperatures).
For more information on instances, see Deploy On-Demand Reports.
Report
Produce a report using a specified template.
Description | |||
|---|---|---|---|
Request model | POST | ||
Default URL | http://localhost/xlrweb/api/report | ||
Body | Type | JSON (application / JSON) | |
Content | {
"token": "…",
"template": "…",
"type": "PDF",
"screensize": "…"
} | ||
Response | Type | Resource or JSON | |
Value if Success | Report PDF as bytes | ||
Value if Error | {
"endpoint":
"report",
"success": false,
"error": 500,
"message": “…”
"data": null
} | ||
template is one of the template names obtained using the method templates.
To generate a report from a template with an instance, the template must be specified as Template|Instance (the same syntax as delivered in the Templates method).
When run with an instance, all the variables are assigned with the values stored in the instance except for variables assigned using the Date panel.
For those variables, the values stored for these variables are used to calculate an overall duration. That duration is then subtracted from the current time to determine the start date and start time. The end date and end time are set to the current date and time.
type is the format of the response. The following are supported:
PDF format is a file returned in PDF format
Excel format is a file returned in Excel workbook (XLSX) format
Text format is a file returned in text/csv format
XML format is a file returned in XML format
JSON format is data returned in JSON format
Bitmap format is a file returned in bitmap format
screensize indicates the viewport size of the device.
Supported values are:
S Small display e.g., phone
M Medium display e.g., tablet
L Large display e.g., laptop or PC monitor. This is the default if not specified.
Note, this setting only applies to type set to PDF.
The Response is based on the HTTPStatus returned in the header. If Status is 500.1 this indicates an error has occurred in generating the report and the Response body is a JSON object with details about the error.
The request type determines the response body:
A file, the response body is that file in bytes.
JSON, the response body is json object.
The header of the response contains:
Content-Length set to the number of bytes of the file in the body.
Content-Type set to the type in the request
application/PDF, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/json etc.
Content-Disposition set to filename=template.xxx if the type is a file.
Type
If the type is set to Text, XML, JSON or Bitmap, the template must have a Data Management connection configured to export a range from the report to that format.
Text
This format requires a Data Management Date Export Range to Text connection to be configured in the template.
Either Format is supported. The Directory and File settings should be left blank so the defaults can be used. Overwrite should be set to Yes so this template can be reused.
XML
This format requires a Data Management Date Export Range to XML (Schema) connection to be configured in the template.
The Directory and File settings should be left blank so the defaults can be used. Mode should be set to Overwrite so this template can be reused.
JSON
This format requires a Data Management Date Export Range to JSON connection to be configured in the template.
The Directory and File settings should be left blank so the defaults can be used. Mode should be set to Overwrite so this template can be reused.
Bitmap
This format requires a Data Management Date Export Range to Bitmap or Chart to Bitmap connection to be configured in the template.
For either function, the Directory and File settings should be left blank so the defaults can be used.
TemplateSnippets
Obtain an enumeration of snippets a template configured in XLReporter.
A snippet is an image file (.bmp) produced from the template using the Data Management Data Export Range to Bitmap or Chart to Bitmap function. For more information on these functions see DESIGN\Data Management in the Document Library.
Description | |||
|---|---|---|---|
Request model | POST | ||
Default URL | http://localhost/xlrweb/api/templatesnippets | ||
Body | Type | JSON (application / JSON) | |
Content | {
"token": "xxx-xxx-xxx-xxx",
"template": "..."
} | ||
Response | Type | JSON | |
Value | {
"endpoint": "templatesnippets",
"success": true,
"error": 0,
"message": null
"data":
[
{
"name": "RangeSnip1"
},
{
"name": "ChartSnip1"
}
...
]
} | ||
template is one of the template names obtained using the method templates. If the template has an instance, that should be specified along with the template for this method. If any snippet name uses the {Instance} variable, that variable is normalized with the instance name specified and delivered as the name of the snippet in the Response.
The API returns each template snippet with the following information:
name – name of the template snippet (the File setting in the management function)
Snippet
Obtain a snippet using a specified template. Note that this function returns the contents of the snippet file (.bmp) from the last time the report was generated. Typically, the Report method should be called before using this method to ensure that the snippet is up to date.
Description | |||
|---|---|---|---|
Request model | POST | ||
Default URL | |||
Body | Type | JSON (application / JSON) | |
Content | {
"token": "…",
"template": "…",
"snippetName": "…"
} | ||
Response | Type | Resource or JSON | |
Value if Success | Snippet BMP as bytes | ||
Value if Error | {
"endpoint": "snippet",
"success": false,
"error": 500,
"message": "…"
"data": null
} | ||
template is one of the template names obtained using the method templates. If the template has an instance, that should be specified along with the template for this method. If any snippet name uses the {Instance} variable, that variable is normalized with the instance name specified and delivered as the snippet in the Response.
snippet is one of the snippet names obtained using the method templatesnippets.
The Response is based on the HTTPStatus returned in the header. If Status is 500.1 this indicates an error has occurred in obtaining the snippet and the Response body is a JSON object with details about the error.
The request type determines the response body:
A file, the response body is that file in bytes.
JSON, the response body is json object.
The header of the response contains:
Content-Length set to the number of bytes of the file in the body.
Content-Type set to the type in the request
image/bmp
Content-Disposition set to filename=snippet.bmp.