How to Use the API
To use the SRS API, you need to have a valid token. See authentication and execute the following GET/POST requests.
Definition
This api will return definition of SRS.
Execute
This api will execute the SRS and return the result in the specified format.
Note
- Error in any command will return Http Status 200 with status = false and message = error message
- Error in command with name
srssetupwill throw error message and the SRS will stop executing (This can be used to execute business logic before executing the SRS)
Parameters
When executing request, the parameters can be passed via query string, JSON body, or both.
Note
- If a name is duplicated in the query string and JSON body, the query string will take precedence.
| HTTP | |
|---|---|
Renderers
The renderer is the format in which the SRS will be executed. The following renderers are supported:
/api/srs/{SRSID}/run- optimized JSON format (array of tables) for internal use/api/srs/{SRSID}/{name}.json- JSON object, simplified format/api/srs/{SRSID}/{name}.lower.json- JSON object, simplified format with lowercase property names/api/srs/{SRSID}/{name}.html- all columns except those withex="false"; empty commands and commands with typeshiddenorserverare not exported/api/srs/{SRSID}/{name}.xlsx- only columns withex="false"; empty datasets and typeshiddenorserverare not exported/api/srs/{SRSID}/{name}.txt- raw data/api/srs/{SRSID}/{name}.md- raw data with formatted tables/api/srs/{SRSID}/{renderer}.hbs[.html|.pdf|.csv|.txt|.xml|.epp|.svg]- Handlebars templates A template is required in/templateas file{renderer}.hbs/api/srs/{SRSID}/{renderer}.frx[.html|.pdf]- Fast Report templates A template is required in/templateas file{renderer}.frx
Extra query parameters
ptoken- authorization token; see authenticationpscope- comma-separated list of command names to limit execution to those commands.popts- options passed to the renderer, in the format of comma-separated key=value pairs- links - generate links in HTML outputfrom standard SRS format
- -nav
pcolumns- comma-separated list of columns to exclude from the output (only for HTML renderer) ex.:-col1,col2file_name- custom file name for the output file*
*file:
- Default encoding for all files is UTF-8.
- Encoding can be overridden by adding
encodingafter a comma in the query string. - Example ANSI encoding:
/api/srs/123/test.hbs.txt?file_name=test.txt,ansi - Custom file name
/api/srs/123/test.hbs.txt?file_name=test.txt