Render Report API in Ambience/Repertoire 202x

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=[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
    For this example we will use a sample report template with a parameter. The path of this report is:
    For example, “/QA_Samples/RML/Parameters/Password_Parameter.rml”

  4. Creating a HTTP call
    Using the HTTP endpoint, construct the HTTP call to the rml rendering engine by appending ‘?elx.token=’ & the API token.
    For example,
    http://localhost:1740/rml-engine/api/v1/render?elx.token=6175c322-e5bf-425c-b10d-78d886092e52

  5. Construct a header in JSON format.
    For example,
    -H “Content-Type: application/json” -d “{"rml":
    "/QA_Samples/RML/Parameters/Password_Parameter.rml","Password":
    "testparameter","renderDetails": { "RenderAsImage": "Yes", "AllowScreenReaders": "No" }}” -o result.pdf

  6. Test the API call using curl
    For example,
    curl -v -X POST
    http://localhost:8081/rml-engine/render?elx.token=6175c322-e5bf-425c-b10d-78d8
    86092e52 -H “Content-Type: application/json” -d "{"rml":
    "/QA_Samples/RML/Parameters/Password_Parameter.rml","Password":
    "testparameter","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)

Rendering RML Template using Tabular Datasource

API Structure:
[protocol]:[host]:[port]/rml-engine/render?elx-token=[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. Upload the Tabular Datasource up on the Repository module.
    (i.e. FruitSales)

  4. In your local system, edit the RML template using an editor of your choice.
    (i.e. Notepad++)

  5. Go to ‘rml:datasource’ tag & edit the ‘datasource-name’ path to the datasource path over in Ambience 2021.
    For example,
    image

  6. Save the RML template & upload it up to Ambience 2021 Repository Module.

  7. Creating a HTTP call
    Using the HTTP endpoint, construct the HTTP call to the rml rendering engine by appending ‘?elx.token=’ & the API token.
    For example,
    http://localhost:1740/rml-engine/render?elx.token=6175c322-e5bf-425c-b10d-78d886092e52

  8. Test the API call using CURL
    For example,
    curl -v -X POST http://localhost:1740/rml-engine/render?elx.token=6175c322-e5bf-425c-b10d-78d886092e52 -d ‘{“rml”:“[path-to-report]”}’ -o result.pdf


Reference: Report and Datasource Engine Modules · Repository