Jump to content
Changes to the Jaspersoft community edition download ×

Another get report through REST API request


torinfo

Recommended Posts

Like more people on the list I can't get the rest api workin, and I am ALMOST there... sigh

 

My issue is that I succeed in doing the PUT request to generate the report and the answer I get looks ok too! (4 pages 1 file, PDF)

 Howver, I can't get the report itself. If I do a get http://<website>/jasperserver/rest/report/<uuid received from put>?file=report; 

I get a HTTP 404 error.

The only thing that is different from the sample and documentation is that the identifier of the report is in CDATA

 I use asp.net C#, the WebClient class with basic Authentication.

Code:  The resul of the PUT



Post Edited by torinfo at 03/07/2012 21:45

Code: The basic flow to run the report



Post Edited by torinfo at 03/07/2012 21:53



Post Edited by torinfo at 03/07/2012 21:54
Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

I'll answer my own question:

The PUT request to run a query returns a session cookie, and you have to use that cookie in the subsequent GET call with the uuid:

 

 

Code:
// Send PUT, the requestAllResult contains the above <report>...string requestAllResult = httpclient.UploadString("http://website/jasperserver/rest/report/Declaraties/12change/Klant/budget_overzicht_per_klant?RUN_OUTPUT_FORMAT=PDF", "PUT", requestXml);// Extract uuid, and fileSystem.Xml.XmlDocument doc = new System.Xml.XmlDocument();doc.LoadXml(requestAllResult);XmlNode node = doc.DocumentElement.SelectSingleNode("uuid");string uuid = node.InnerText;// Get Session from ResponeHeadersstring session = httpclient.ResponseHeaders.Get("Set-Cookie");httpclient.Headers.Add("Cookie", session);//Build GET URLstring reportUrl = "http://website/jasperserver/rest/report/";reportUrl += uuid;reportUrl += "?file=report";// Get reportstring report;report = httpclient.DownloadString(reportUrl);
Link to comment
Share on other sites

  • 1 year later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...