Reports REST request yields empty response in Jasperreport Server

0

I am running a fresh Jasperserver CE in docker (bitnami image). I can interactively log into the server and create a test report (without data adapter) that successfully runs. However, using the REST API, whenever I request 

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

I get an empty response with HTTP status 204 (no content). Other resources, such as login, logout, or 

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

yield meaningful results. So the REST API works correctly in principle. 

My request is properly authenticated with the credentials of an admin user. The report was built in Jaspersoft Studio 6.13, JasperReports Server version is 7.5. 

What am I missing? Is there some configuration change necessary so that reports can be listed via REST? 

matthias.budde's picture
Joined: Jul 14 2020 - 4:28am
Last seen: 1 hour 9 min ago

I seem to be getting a bit closer.

I noticed that under 

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

the reports were not listed as well. So I created a user (with ROLE_USER) and tried this one for the REST requests. Now, the reports are listed under http://<host>:<port>/jasperserver/rest_v2/resources at least. Still, http://<host>:<port>/jasperserver/rest_v2/reports yields an empty response body with status code 204.

But now, when I try to directly GET a report via 

http://<host>:<port>/jasperserver/rest_v2/<foldername>/<reportname>

I suddenly get an "Access is denied" response with status code 403. Before, with the admin user, I received a 404.

Seems I made some progress, but I am still stuck. All permissions to reports and the full folder tree are set to RWD* for ROLE_USER. Really not seeing the issue here...

matthias.budde - 3 days 1 hour ago

1 Answer:

0

Ok, it seems I got it all wrong. 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. The things that triggered the 403 access denied when trying my approach in the comment above were (a) that I got the URL wrong (missing "reports/") and (b) that I forgot the file extension (.pdf in my case)

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

did the trick. I still don't get why this can only be done by a user (ROLE_USER) and not an admin (ROLE_ADMINISTRATOR), but that is not a practical issue for me. 

 

matthias.budde's picture
Joined: Jul 14 2020 - 4:28am
Last seen: 1 hour 9 min ago
Feedback