Jump to content
JasperReports 7.0 is now available ×

Rest API : get the report result


flienart

Recommended Posts

Hi,

I have some trouble to get the resulting report when i launch a call to REST.

With postman, il send a GET to this endpoint for logging :

http://srv-test:8080/jasperserver/rest_v2/login?j_username=user&j_password=pwd.

In Postman, i get a cookie with a JSESSIONID.

Next, i launch this POST query to execute a report (same cookie) :

http://srv-test:8080/jasperserver/rest_v2/reportExecutions

This is the body :

<reportExecutionRequest>
    <reportUnitUri>/reports/interactive/TableReport</reportUnitUri>
    <async>false</async>
    <freshData>true</freshData>
    <saveDataSnapshot>false</saveDataSnapshot>
    <outputFormat>pdf</outputFormat>
    <interactive>true</interactive>
</reportExecutionRequest>

I check the headers request to verify if this is the same cookie. It's the same.

This is the response :

{
    "status""ready",
    "totalPages"4,
    "requestId""6f8ab161-597d-43e8-bc4c-b0f74316b69c",
    "reportURI""/reports/interactive/TableReport",
    "exports": [
        {
            "status""ready",
            "outputResource": {
                "contentType""application/pdf",
                "fileName""TableReport.pdf",
                "outputFinal"true,
                "outputTimestamp"0
            },
            "id""36e04925-194f-4032-af92-c3589d9042be"
        }
    ]
}

When i launch the final query (GET) to retrieve the report i get an error. (same cookie in header)

http://srv-test:8080/jasperserver/rest_v2/reportExecutions/6f8ab161-597d-43e8-bc4c-b0f74316b69c/exports/36e04925-194f-4032-af92-c3589d9042be/outputResource
 
Error :
 
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<errorDescriptor>
    <errorCode>resource.not.found</errorCode>
    <message>Ressource 
36e04925-194f-4032-af92-c3589d9042be introuvable.</message>
    <parameters>
        <parameter>
36e04925-194f-4032-af92-c3589d9042be</parameter>
    </parameters>
</errorDescriptor>

I don't understant why i get this error because it's the same cookie for each query...

Thanks in advance for reply.

Sorry for my poor english.

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Is your requirement to get the report in PDF?
If yes, I think you can achieve this by simply issuing the following URL in the GET method.

* Reference
https://community.jaspersoft.com/documentation/tibco-jasperreports-server-rest-api-reference/v790/reports-service

* Example URL
http://srv-test:8080/jasperserver/rest_v2/reports/public/test_report.pdf?j_username=user&j_password=pwd

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...