markwilliamson101 Posted February 26, 2017 Share Posted February 26, 2017 Hi All,Based on a previous questions anser, I created a report in Jaspersoft Studio and uploaded it to the server. I can see the report and report data now which is a great start for me. However, I am trying to test the REST API now but I am only getting a repsonse "resource not found". WIthin the server I can see on the left menu a folder called Reports, just above the themes folder. In Reports, I can see my sample report, called Simple_Blue. And when I created the report in Jaspersoft Studio, I named the file main_jrxml. So when I was trying to test the REST call, in the hope of getting the data back in pdf or csv I tried adding said extension to the end of the url, like...http://localhost:8080/jasperserver/rest_v2/reports/reports/simple_blue/main_jrxml.pdfHowever, I can not get it to work. I also tried http://localhost:8080/jasperserver/rest_v2/reports/simple_blue/main_jrxml.pdf dropping one of the reports arguments. Does the REST API work in the community edition?If so, can the REST API return back the reports content in various forms or files? Also, if that is possible could the report page itself as well as the REST calls be set up with configurable authentication, date filters or optional paramaters. Ultimatley I would like to make a REST call passing in start dates and end dates along with a optional param and get back a file such as a csv or pdf. Any help appreciated. Best,Mark Link to comment Share on other sites More sharing options...
reportdev Posted February 27, 2017 Share Posted February 27, 2017 try usinghttp://localhost:8080/jasperserver/rest_v2/reports/reports/simple_blue/main_jrxml.pdfi believe, after rest_v2, reports specifies the type of resource that you are trying to access. Link to comment Share on other sites More sharing options...
hozawa Posted February 27, 2017 Share Posted February 27, 2017 What kind of error are you getting? If you are getting authentication error, you need to provide JasperReports Server username and password to your uri:http://localhost:8080/jasperserver/rest_v2/reports/reports/simple_blue/main_jrxml.pdf?j_username=<user name>&j_password=<password> Link to comment Share on other sites More sharing options...
Solution markwilliamson101 Posted February 28, 2017 Author Solution Share Posted February 28, 2017 Ok so discovered the name of the file is not needed in the url. From Jasper Server, when you navigate to reports, then right click report to get its properties, there it wil show the path e.g /reports/folder/ReportNameI just use this as the end of the url e.ghttp://localhost:8080/jasperserver/rest_v2/reports/reports/folder/ReportNameIf you now want said report back in PDF or CSV just add that extension....http://localhost:8080/jasperserver/rest_v2/reports/reports/folder/ReportName.pdfURL Query Params also work, these have to be created both as parameters in the report, which are used in the SQL query, and also taken in as a Controls & Resources input control params on the server side. You can do this by editing the report within the server, Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now