I don't want to send the report parameters in the browser URL like this:
/jasperserver/flow.html?_flowId=viewReportFlow&_flowId=viewReportFlow&ParentFolderUri=%2FPublished&reportUnit=%2FPublished%2FUser_Report&decorate=no&standAlone=true
I'm very interested to do POST requests and display it in the same jasper server report viewer as always.
Is this posible ?
1 Answer:
Yes, Jaspersoft Server's REST API allows for report execution with POST using the reportExecutions service.
I've attached the following HTTP request sample of this using Postman. The first request is a synchronous request to execute the report. It returns the necessary request and export information. The second request retrieves the report output from the previous execution. You can choose to run an asynchronous request for longer running reports if preferred.
POST /jasperserver-pro79/rest_v2/reportExecutions HTTP/1.1 Host: localhost:8080 Authorization: Basic c3VwZXJ1c2VyOnN1cGVydXNlcg== Content-Type: application/xml Cookie: userLocale=en_US; JSESSIONID=9E0BBE880F49C7987CAE6C4E43252641 Content-Length: 509 <reportExecutionRequest> <reportUnitUri>/public/Samples/Reports/01._Geographic_Results_by_Segment_Report</reportUnitUri> <async>false</async> <freshData>false</freshData> <saveDataSnapshot>false</saveDataSnapshot> <outputFormat>html</outputFormat> <interactive>true</interactive> <ignorePagination>true</ignorePagination> <parameters> <reportParameter name="Country"> <value>USA</value> </reportParameter> </parameters> </reportExecutionRequest>
GET /jasperserver-pro79/rest_v2/reportExecutions/ad0edbf2-abd2-4ebe-8344-b2e453eab496/exports/79662286-aa90-4e98-a732-337ab5ee0504/outputResource HTTP/1.1 Host: localhost:8080 Authorization: Basic c3VwZXJ1c2VyOnN1cGVydXNlcg== Cookie: userLocale=en_US; JSESSIONID=9E0BBE880F49C7987CAE6C4E43252641