PIWebAPI BATCH using Postman
PIWebAPI is the API endpoint to access PI System. It provides an easy way to access PI System. It is possible to notice, after some time dealing with PIWebAPI, that creating a query can be very challenger. Passing a lot of parameters, passing WebID needed and getting results from another queries will turn into a very complex task.
PIWebAPI BATCH request is a very useful controller that can handle multiple requests to PI System. It is very useful to build a query avoid using WebIDs. To perform such a query it is possible to use Postman. Postman is a API client where is possible to organize API queries and it can be downloaded at this link: https://www.postman.com/downloads/.
To use BATCH mechanism in Postman, create a POST request against https://<PISERVERNAME>/piwebapi/batch/. fill in the authorization needed and add Content-Type "application/json; cherset=UTF-8" on Headers
BATCH mechanism should be specified at Request's Body. In the example bellow there is a batch request to get Event Frames that are currently "In Progress", given a start time and and Element Path.
As noticed, there is no need to use hard coded WebIDs on this request if using the batch mechanism. Each query works as a step sequence for the other.
Postman allow postman variables usage, identified by double brace {{VariableName}}. These variables are defined at pre-request Script.
It is possible to find a simple AF Tree-view and a simple Postman Collection example at the github repository below. This specific Postman Collection contains several of the main batch requests to deal with AFTables, AFDatabase, Elements, Attributes, Values and Event Frames. You can check and import to your Postman accessing it from the following github address:
Import the PISERVER.postman_collection.json json file to your Postman app as shown below.
Tech Lead | PIMS | AVEVA OSIsoft PI System | AI & ML | White Belt
2 年Good tip, Pedro! I just added this one on my favorite list!
Engenheiro de dados e professor da Jornada
2 年thanks for sharing
Manager, Data Intelligence & Analytics | AVEVA/OSIsoft PI SME
2 年Saved for reference! Thanks Pedro.