Showing results for 
Search instead for 
Did you mean: 

API(s) for Prognosis?

05 Base Camper

Re: API(s) for Prognosis?

This is sorted thanks for your help,

I am trying to access the data in python, I am getting the data in XML format.

how do I parse the XML out put as per my requirment, is there a way to convert it to JSON format in (keySmiley Tongueair) values.?

Is there any guid to access the data in data by parsing it?

12 Sherpa

Re: API(s) for Prognosis?



Our basic guide just covers how you can get the data. You should be able to specify the header options to expect JSON data or modify the content-type of your POST request.

{'content-type' : 'application/x-www-form-urlencoded'}



The data returned is still going to be array format (data.rows and data.headers) and not key value pair, but you can do a simple transformation to get rest data into json data. I had a small function for that as below:



function restDataToJSON (restData) {
   var i, j;
   var json = [];
   if (restData && restData.rows)   {
      for (i = 0; i < restData.rows.length; i += 1) {
         var row = {};
         for (j = 0; j < restData.rows[i].length; j += 1) {
            row[restData.headers[j]] = restData.rows[i][j];
   return json;



If my reply answered your question please click on the 'Accept as Solution' button to help others find the answer.