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?

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: The Journey to Microsoft Teams - Readiness Phase (part 2)

Having looked at the planning phase in session one of this series, we will turn our focus to the readiness phase. The all important technical capabilities assessment, ensuring the network, endpoints and users are adequately prepared for the move.

Hear first hand from IR's Global Head of Information Systems and Technology, Jason Schwendinger, on how he has been tackling these issues.

Join webinar