Params as Headers via REST Call.

0

Can you pass Params\InputControls as Headers instead of Query String via REST API?

reachme2405's picture
Joined: Dec 6 2018 - 5:15pm
Last seen: 1 month 6 days ago

1 Answer:

0

Hi ReachMe, 
You can have a look at the document "TIBCO JASPERREPORTS® SERVER REST API REFERENCE".
Section "CHAPTER 13 THE reportExecutions SERVICE"
I think this is the only way, besides making use of visualise.js (js lib for enterprise jaspersoft)

Make a report request first via a POST 
Example :
https://localhost:8443/jasperserver/rest_v2/reportExecutions

Headers
X-REMOTE-DOMAIN : 1
Content-Type : application/json

Body 
{
  "reportUnitUri" : "path_to_report_on_server/myfirstreport",
  "outputFormat" : "html",
  "parameters" : {    
                    "option":[
                      {
                        "name":"myInputControl_1",
                        "value":["HelloValue"]
                      },
                      {    
                          "name":"myInputControl_2",
                          "value":["DAILY","WEEKLY","MONTHLY"]
                    }
                    ]
                }
}

If 200, you will received a xml response with a requestId in it. You will then make use of this requestid
<requestId>2f373725-5190-43a3-8ea4-a8fa96f52a05</requestId>

Then you need to do a GET request with the requestid
https://localhost:8443/jasperserver/rest_v2/reportExecutions/2f373725-51...

if 200, you will receive a xml response, look into the <export> tag and look for the <id > 
<exports>
    <export>
         <attachments>…</attachments>
         <id>fdd2322d-2e48-4a63-a661-8155501a19fe</id>

You will required the id to do another GET reqeust. You need the requestid and the id above. 
https://localhost:8443/jasperserver/rest_v2/reportExecutions/2f373725-51...

if 200, then you will get response with the report. So in this scenario a html  document

Hope this helps you out.
 

joseng62's picture
732
Joined: Dec 5 2014 - 2:43am
Last seen: 21 hours 59 min ago
Feedback
randomness