Jerome Lefebvre

Bulk creation of event frame comparison displays - an experiment

Blog Post created by Jerome Lefebvre Employee on Aug 5, 2019

I am just sharing an experiment, this is in no way is the following usage of PI Vision a supported usage of PI vision. The comments are also disabled as indication that you are on your own if you want to try this. This uses internal APIs for PI Vision to create displays, creating displays in such a way may lead to corruptions of your PI Vision displays. Do not try for reason other than fun and exploration.

 

 

PI Vision Event Frame overlay displays are very useful, to look into the details of a particular event and how they differ from other events. One of the feature that they lack is support for URL parameters, it is not possible to simply update your URL and view different set of event frames. The way this is dealt with is by creating many different event frame overlay pages, all with different queries.

 

This has been requested here:

https://feedback.osisoft.com/forums/320517-pi-vision/suggestions/13659663-url-parameter-support-for-events

 

In this experiment, I play around with the creation of such displays by using the internal requests made by the browser to the PI Vision service.This is done via Chrome, Postman and PowerShell.

https://feedback.osisoft.com/forums/320517-pi-vision/suggestions/13659663-url-parameter-support-for-events

Chrome

The web browser, Chrome, offers a lot of tools to debug websites. We can use them to explore the iteration between the browser and the PI Vision server. Here, we want to look at the network logs, to see the exactly happens when we hit save on an overlay page. Hitting F12, we do have a very promising requests (screenshot directly below).

 

 

Chrome is very good at looking at the details of the requests that have already been made. But, to make further requests I prefer to use a tool such as Postman. Let's export this request and import it back in Postman.

 

Export the request:

 

Import the request:

 

 

Postman

In postman, you now free to play around with the requests, see what happens when you change a value.

In particular, you can make new displays by making new requests.

 

If for example, the creation went well, you receive the ID for the new displays.

 

You can try to tweak the request until you create event frame overlay displays with exactly the search parameters you want.

 

Postman also has the ability to create code snippets in various language. This means, it will turn your snippet into a working Powershell, python, etc. requests, 

 

In my case I picked PowerShell.

 

PowerShell

 

In here, there is nothing really to explain. I want to create displays, and postman give me all the code I needed to make that request. From PowerShell, all I need is the for loop construct.

Outcomes