Endpoint example to export using template

This is a quick tutorial on how to use R4J's web services using CURL command. The following example will allow a faster start for users to use the R4J web services. 

POST

https://eu.r4j-cloud.easesolutions.com/rest/api/1/projects/{projectId}/export

Export issue details on Word format

/rest/api/1/projects/{projectId}/export

The data in the response body when using R4J REST API (excluding the file exported in Tree UI) is in base64 format and can be decoded to a word document (.docx).

Example

# Get list of projects (with projectId) curl -X GET https://eu.r4j-cloud.easesolutions.com/rest/api/1/projects \ -H 'authorization: JWT <Token>' # Get list of templates (with templateId) curl -X GET https://eu.r4j-cloud.easesolutions.com/rest/api/1/export-template \ -H 'authorization: JWT <Token>' # Start export from project with id <projectId> # of folder with id <issueId> using template with id <templateId> # returns <taskId> curl -X POST https://eu.r4j-cloud.easesolutions.com/rest/api/1/projects/<projectId>/export \ -d '{"templateId": <templateId>, "itemOrIssueId": "<issueId>", "filter": null, "scope": "TREE_VIEW"}' \ -H 'Content-Type: application/json' \ -H 'authorization: JWT <Token>' # Poll export status, store reply to a file called <taskId> curl -X GET https://eu.r4j-cloud.easesolutions.com/rest/api/1/tasks/<taskId> \ -O \ -H 'authorization: JWT <Token>' # Check status of export jq -r '.status' <taskId> # If status “finished” # Convert data in data-field to docx (or xlsx, check with used template) jq -r '.data | .data' <taskId> | base64 --decode > /mnt/c/tmp/Export.docx