Search code examples
restjasper-reportsjasperserver

How to call a jasper report through REST_V2 service with a specification what dataSource from repository should be used?


I have this scenario:

  1. Created a jasper report and uploaded to JasperSoft Server: "MyTestReport"
  2. Uploaded report does not have a link to dataSource in JSS
  3. In JasperSoft Server I have defined two datasources: AGD and AGL

I would like to call report through "rest_v2" service from database. My URL to list resources looks like: http://myserverurl:8081/jasperserver/rest_v2/resources

Q1: How to pass a correct datasource to this report? http://myserverurl:8081/jasperserver/rest_v2/reports/reports/MyTestReport.pdf?j_username=jasperadmin&j_password=jasperadmin

Q2: Is there an option how to authenticate it in more secured way?


Solution

  • I don't think you can pass the datasource with the rest interface (but feel free to check that in the JasperReports-Server-Web-Services-Guide).

    What I'd do is copy the report in Jasperserver and link one to datasource AGD and one to AGL. Then you can get your code to call the required report.

    It's possible to integrate your application using single sign on so you don't have to pass the login on the url line (or I guess you could also use ssl)

    This is covered in the jasperserver authentication cookbook which is available on the jaspersoft community site.