Rest API : get the report result

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_passwo....

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)

 
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.

flienart's picture
Joined: Nov 30 2021 - 2:44am
Last seen: 6 months 1 week ago

1 Answer:

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-serve...

* Example URL
http://srv-test:8080/jasperserver/rest_v2/reports/public/test_report.pdf...

 

yama818's picture
6461
Joined: Aug 17 2018 - 3:48pm
Last seen: 3 weeks 5 days ago
Feedback