Ambience 202x / Repertoire 202x API - Managing Files In Server Repository

Overview
These API methods and curl commands provide efficient solutions for creating a folder, uploading and removing files in the server repository using Repertoire 2024.


1. Creating a Folder in the Server Repository

curl -v -k -H "Authentication: elx.token YOUR_ELX_TOKEN" 
-H "Content-Type: application/json" 
--data "{\"path\": \"/User/admin\", \"name\": \"FarhanaTest\"}" 
http://localhost:1730/repository/action/add-folder

Details:

  • Endpoint: /repository/action/add-folder
  • Method: POST
  • Authentication Header: Use elx.token with your specific token.
  • Parameters:
    • path: The parent directory where the new folder will be created.
    • name: The name of the new folder.

2. Uploading a File to the Server Repository

curl -v -k -X POST http://localhost:1730/repository/action/upload \
-H "Authentication: elx.token YOUR_ELX_TOKEN" \
-H "Accept: application/json" \
-F "file=@/Elixir/Repertoire-2024.0.7/repository/User/admin/TestHello.txt" \
-F "json={\"path\":\"/User/admin/def\", \"overwrite\":true}"

Details:

  • Endpoint: /repository/action/upload
  • Method: POST
  • Authentication Header: Use elx.token with your specific token.
  • Parameters:
    • file: Path to the file being uploaded.
    • json: Includes destination path (path) and an overwrite flag.

3. Reading a File from the Repository

curl -X GET -O "Fruit100.ds" \
-H "Authentication: elx.token YOUR_ELX_TOKEN" \
"http://localhost:1740/repository/api/v1/read?path=/ElixirSamples/DataSource/Fruit100.ds"

Details:

  • Endpoint: /repository/api/v1/read
  • Method: GET
  • Authentication Header: Use elx.token with your specific token.
  • Parameters:
    • path: Path to the file in the repository.

4. Checking Write Permissions

curl -X GET -H "Authentication: elx.token YOUR_ELX_TOKEN" \
"http://localhost:1740/repository/api/v1/can-write?path=/ElixirSamples"

Details:

  • Endpoint: /repository/api/v1/can-write
  • Method: GET
  • Authentication Header: Use elx.token with your specific token.
  • Parameters:
    • path: Path to the file/folder being checked.

5. Writing a File to the Repository

curl -X POST -H "Content-Type:application/octet-stream" \
-H "Authentication: elx.token YOUR_ELX_TOKEN" \
-d @/ElixirSamples/DataSource/Fruit100.ds \
"http://localhost:1740/repository/api/v1/write?path=/ElixirSamples/DataSource/Fruit100Upload.ds"

Details:

  • Endpoint: /repository/api/v1/write
  • Method: POST
  • Authentication Header: Use elx.token with your specific token.
  • Parameters:
    • path: Destination path including the filename.

6. Removing a File from the Server Repository

curl -v -k -H "Authentication: elx.token YOUR_ELX_TOKEN" \
-H "Content-Type: application/json" \
--data "{\"path\":\"/User/admin/abc/Test246.txt\"}" \
http://localhost:1730/repository/action/delete-file

Details:

  • Endpoint: /repository/action/delete-file
  • Method: POST
  • Authentication Header: Use elx.token with your specific token.
  • Parameters:
    • path: Path to the file being deleted.

7. Uploading an Archive to the Repository

curl -X POST -H "Authentication: elx.token YOUR_ELX_TOKEN" \
--form file=@example.zip \
--form path="/User/admin/test-upload" \
http://localhost:1730/repository/api/v1/upload-archive

Details:

  • Endpoint: /repository/api/v1/upload-archive
  • Method: POST
  • Authentication Header: Use elx.token with your specific token.
  • Parameters:
    • file: ZIP archive to upload.
    • path: Destination folder (must already exist).

8. Downloading an Archive from the Repository

curl -X POST -O -H "Authentication: elx.token YOUR_ELX_TOKEN" \
"http://localhost:1740/repository/api/v1/download-archive?path=/ElixirSamples/DataSource"

Details:

  • Endpoint: /repository/api/v1/download-archive
  • Method: POST
  • Authentication Header: Use elx.token with your specific token.
  • Parameters:
    • file: ZIP archive to upload.
    • path: Folder path to download as a ZIP archive.

9. Generates a DS File

curl -X POST -H "Content-Type: application/json" \
-H "Authentication: elx.token YOUR_ELX_TOKEN" \
-d '{"ds": "/ElixirSamples/DataSource/FruitSales.ds"}' \
-o fruit.json \
"http://localhost:1740/ds-engine/api/v1/generate"

Details:

  • Endpoint: /ds-engine/api/v1/generate
  • Method: POST
  • Authentication Header: Use elx.token with your specific token.
  • Parameters:
    • ds: Path to the DS file.

10. Renders RML File

curl -X POST -H "Content-Type: application/json" \
-H "Authentication: elx.token YOUR_ELX_TOKEN" \
-d '{"rml": "/ElixirSamples/Report/RML/Pivot Table.rml", "Staff Name": "Alan Koh"}' \
-o output-rml.pdf \
"http://localhost:1740/rml-engine/api/v1/render"

Details:

  • Endpoint: /rml-engine/api/v1/render
  • Method: POST
  • Authentication Header: Use elx.token with your specific token.
  • Parameters:
    • rml: Path to the RML file.
    • Other parameters required by the RML.

11. Renders RML File and Stores It on The Server

curl -X POST -H "Content-Type: application/json" \
-H "Authentication: elx.token YOUR_ELX_TOKEN" \
-d '{"rml": "/ElixirSamples/Report/RML/Master-Detail Report.rml"}' \
"http://localhost:1740/rml-engine/api/v1/render-to-store"

Details:

  • Endpoint: /rml-engine/api/v1/render-to-store
  • Method: POST
  • Authentication Header: Use elx.token with your specific token.
  • Parameters:
    • rml: Path to the RML file.
    • Other parameters required by the RML.

12. Renders RML to The Webstore

curl -X POST -H "Authentication: elx.token YOUR_ELX_TOKEN" \
-H "Content-Type: application/x-www-form-urlencoded" \
"http://localhost:1740/rml-engine/api/v1/render-form?rml=/ElixirSamples/Report/RML/Master-Detail Report.rml"

Details:

  • Endpoint: /rml-engine/api/v1/render-form
  • Method: POST
  • Authentication Header: Use elx.token with your specific token.
  • Parameters:
    • rml: Path to the RML file.
    • Other parameters required by the RML.

13. Renders RML to Report Portal

curl -X POST -H "Content-Type: application/json" \
-H "Authentication: elx.token YOUR_ELX_TOKEN" \
-d '{"rml": "/ElixirSamples/Report/RML/Master-Detail Report.rml", "mimeType": "application/json"}' \
"http://localhost:1740/rml-engine/api/v1/render-to-portal"

Details:

  • Endpoint: /rml-engine/api/v1/render-to-portal
  • Method: POST
  • Authentication Header: Use elx.token with your specific token.
  • Parameters:
    • rml: Path to the RML file.
    • Other parameters required by the RML.

14. Renders a DOCX File

curl -X POST -H "Content-Type: application/json" \
-H "Authentication: elx.token YOUR_ELX_TOKEN" \
-d '{"docx": "/ElixirSamples/Report/DocX/Customer Profile by Location.docx", "city": "Burnaby"}' \
-o output.docx \
"http://localhost:1740/docx-engine/api/v1/render"

Details:

  • Endpoint: /docx-engine/api/v1/render
  • Method: POST
  • Authentication Header: Use elx.token with your specific token.
  • Parameters:
    • docx: Path to the DOCX file.
    • Other parameters required by the DOCX file.

15. Queueing a Report

curl -X POST -H "Content-Type: application/json" \
-H "Authentication: elx.token YOUR_ELX_TOKEN" \
-d '{"rml": "/ElixirSamples/Report/RML/Master-Detail Report.rml", "mimeType": "application/pdf"}' \
"http://localhost:1740/rml-engine/api/v1/queue-report"

Details:

  • Endpoint: /rml-engine/api/v1/queue-report
  • Method: POST
  • Authentication Header: Use elx.token with your specific token.
  • Parameters:
    • rml: Path to the RML file.
    • mime-type: Output format. Defaults to application/pdf.

16. Retrieving a Queued Report

curl -X GET -OJ -H "Authentication: elx.token YOUR_ELX_TOKEN" \
"http://localhost:1740/rml-engine/api/v1/get-report/REPORT_ID"

Details:

  • Endpoint: /rml-engine/api/v1/get-report
  • Method: GET
  • Authentication Header: Use elx.token with your specific token.
  • Parameters:
    • Report_ID: Report ID returned by queue-report.

17. Canceling a Queued Report

curl -X POST -H "Authentication: elx.token YOUR_ELX_TOKEN" \
"http://localhost:1740/rml-engine/api/v1/cancel-report/REPORT_ID"

Details:

  • Endpoint: /rml-engine/api/v1/cancel-report
  • Method: POST
  • Authentication Header: Use elx.token with your specific token.
  • Parameters:
    • Report_ID: Report ID returned by queue-report.

Please remember to revise any values such as file paths, tokens, and server URLs to match your specific environment before executing these commands.