Highlighted
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?

Highlighted

Re: API(s) for Prognosis?

@Amol 

 

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];
         }
         json.push(row);
      }
   }
   return json;
}

 

 


If my reply answered your question please click on the 'Accept as Solution' button to help others find the answer.
Thanks,
Shoaib
Webinar: Keep the modern workforce connected

Unified Communications has always been an important part of companies' digital transformation efforts due to its ability to enable rich virtual collaboration and communication. But with COVID-19, we've reached a break-through point.

Join Bill Haskins, Sr. Analyst & Partner, Unified Communications at Wainhouse Research, and John Ruthven, CEO at IR discuss UC challenges companies are experiencing due to the COVOID-19 crisis.

Join webinar