torinfo Posted March 7, 2012 Share Posted March 7, 2012 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:53Post Edited by torinfo at 03/07/2012 21:54 Link to comment Share on other sites More sharing options...
torinfo Posted March 9, 2012 Author Share Posted March 9, 2012 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 More sharing options...
kcd Posted March 15, 2013 Share Posted March 15, 2013 "Dates and date/times must be represented as the number of milliseconds since January 1, 1970, 00:00:00 GMT." 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