This is an example on how to call Ambience/Repertoire 202x API to output a RML template using curl.
Rendering RML Template w/ Parameters
API Structure:
[protocol]:[host]:[port]/rml-engine/render?elx-token=[api-token-value]
1/ Create API Token
- Add an API token and assign a user account to this API token. The API token string will be appended to the API call in a later step.
2/ Create Role
- Add a role and assign a user that has the following access privileges, mod-ds-engine & mod-rml-engine
3/ Sample Report Template
- We will use a sample report template with a parameter. The path of this report is: “/Samples/RML/Parameters/Password_Parameter.rml”
- This report has a parameter as follows:
4/ Sample API Call
- With the details gathered above, a sample api call using “curl” to render a report in PDF format will be as follows:
curl -v -X POST http://localhost:1740/rml-engine/api/v1/render?elx.token=6175c322-e5092e52 \
-H “Content-Type: application/json” \
-d “{“rml”: “/Samples/RML/Parameters/Password_Parameter.rml”,“Password”: “p@ssw0rd”,“renderDetails”: { “RenderAsImage”: “Yes”, “AllowScreenReaders”: “No” }}” \
-o result.pdf
Notes:
- Another way would be to write the report template, its rendering options and parameters to a JSON file and specify the path of the JSON file.
- For more details, do take a look at this documentation:
Rendering a report template via REST API.pdf (287.6 KB)