apirestjasperserver

Jasperreports Server: Reports not shown via REST


I use the Jasperreports Server CE. I have logged on to the webinterface and made a new report.

When I request the list of reports, the new report is not shown.

http://mymachine:myport/jasperserver/rest_v2/reports

only returns an empty response body. HTTP status is 204.

How can I access/list reports?


Solution

  • I had the same problem. It seems, like myself, you have the same wrong expectation as I had: I assumed that

    GET http://<host>:<port>/jasperserver/rest_v2/reports
    

    would list all reports, as that was my expectation from working with other REST APIs. This assumption was wrong.

    After playing around and reading the manual more carefully than before, I eventually got it right. Calling reports is only used to retrieve a specific report (don't forget the file extension, e.g .pdf in my case):

    GET http://<host>:<port>/jasperserver/rest_v2/reports/<folderpath>/<reportname>.pdf
    

    In order to get all reports you need to use request resources instead instead of reports. This will return all resources:

    GET http://<host>:<port>/jasperserver/rest_v2/resources/
    

    To only list reports, you can filter by type (and optionally also just check a subfolder):

    GET http://<host>:<port>/jasperserver/rest_v2/resources/<folderpath>?type=reportUnit&recursive=1