AnsweredAssumed Answered

How can we call bach request using jquery ?

Question asked by Babasaheb on Jul 19, 2017
Latest reply on Jul 20, 2017 by Paurav Joshi

I refer below link to call the batch requests. But it shown in JSON format and I want to cal this batch request using jQuery.

 

PI Web API: Getting multiple attributes with batch requests

https://techsupport.osisoft.com/Documentation/PI-Web-API/help/controllers/batch/actions/execute.html

 

Here is my code. Please can someone tell me how to write this function for batch request ?

 

<script>

 

var processJsonContent = function(){

            return $.ajax(

{

url: "https://ServerName:4440/piwebapi/assetdatabases?path=\\\\ServerName\\DatabaseName",

contentType:"application/json",

Type:'Get',

//data: '{"username": "' + username + '", "password" : "' + password + '"}',

success: function (data){

//alert('connected'+ JSON.stringify(data));

console.log('Database Connected'+ JSON.stringify(data));

},

error:function(xhr){

console.log(xhr.responseText);

},

beforeSend: function (xhr){

xhr.setRequestHeader('Authorization','Basic ZWNnXdsfgRT34Y3RfMjAxNg==');

}

}

);

}

</script>

 

 

Thank you

Outcomes