How to generate and access a report with REST API

This guide will show you how to obtain and access a report that contains data, using REST API.

Requisites

The Report REST API resource requires the following information when using it:

Resources used

  • Report > reports - to get the reportID
  • Report > renderings - to get the renderingID
  • Report > renderingsID:long - to get the report link (where the report data lies).

Get the reportID

The first step is obtaining the reportID.

1. Log in to http://host_name/comGpsGate/api/v.1/test 

Note: replace host_name with your actual server IP address or DNS name.

2. Click on the resource name reports, and select Try it out 

/applications/{applicationid:int}/reports

mceclip1.png

3. Fill the applicationID, then click on Execute

mceclip2.png

4. You will get a list of reports with their default parameters.

Save the applicationID for later use.

mceclip3.png

Note: keep the model open to use the data for the next resource.

Get the renderID

Now we need to generate a render of the report and optain its renderID. For that we'll use the following resource:

/applications/{applicationid:int}/reports/{reportid:int}/renderings

1. Click on Try it out

mceclip4.png

2. Fill in the model data (with the required parameters) to obtain the renderID, then click on Execute.

Note: if you need help with your model, we recommend you using the resource: /applications/{applicationid:int}/reports/{reportid:long} this resource generates a model with parameters needed in this step.

  • Use the parameter "reportFormatId": 2 if you want to generate your report in CSV format.

mceclip5.png

3. You should get a response. The renderID is the one marked in red:

mceclip6.png

Get the report

Finally, we will use the following resource to get the report

1. Click on Try it Out

mceclip7.png

2. Fill in the ApplicationID, ReportID and RenderingID obtained in previous steps:

3. Click on Execute

mceclip0.png

4. In the results you will get the link of the report.

mceclip2.png

5. Compose the URL using your server + the link

mceclip3.png