Let's start getting familiar with the PI Web API
in one of the most common HTTP clients out there Google Chrome.
If you're using the default self-signed certificate when you're opening the base
URL for the PI Web API through a browser it can be reached to the fully qualified
machine name followed by a slash and then PI Web API. Again I just want to reiterate
that venus.holst.dev is a personal test system and you won't be able to connect
to it from your machine. When attempting to reach this page it will request our
credentials so we can authenticate. Once we're authenticated we arrive at the main landing page,
one thing I'd like to point out is the link to the help pages in the upper left hand
corner. If you're new to the PI Web API it is beneficial to visit these to get started.
In the main part of the page you can also see the list of links to different resources in
JSON format. We can view our data servers, asset servers, as well as the overall system
configuration. Since the PI Web API is a restful interface and therefore stateless,
no clients information is stored on the server in between requests. So if we make two requests to
the PI Web API, the second request is completely independent of the first. Other characteristics
include the fact that all resources are identified by URLs, all we need to know
is the correct URL in order to properly find the resource or information that we're looking for.
For example if we click on the data servers link on the landing page will find that this
brings us to a new page with a new URL and shows us the data servers resources. We can
see multiple data servers are reachable by this PI Web API instance. The resources
exposed by the PI Web API are connected via links so when you're building your client
application you don't necessarily need to construct URLs, but rather you can go one
resource to the next and navigate through the links. Let's take a look at the system link.
The system link allows you to take a look at the configuration information for the PI Web
API instance you're currently connected to. For example if we select the user info endpoint we
can see the currently connected user. If we select the version endpoint we can see the
version of the PI Web API that we're currently connected to. If we select the configuration
endpoint we can see the configuration information on the PI Web API instance that we're currently
connected to, including what authentication methods are allowed among other things.
We'll be revisiting some of these configuration parameters in later videos.
Other resources you may be more interested in are the data servers or the PI Data Archive links,
as well as the asset servers or AF server links. When we click on the data server link we can see
that we have two PI Data Archives. If we select the self link we can also see some
basic information about that server as well such as the name and the server version. Again,
it's worth noting that in this particular test system the PI Web API and the data archive are
on the same machine so they happen to have the same name in this particular setup.
From here we can use the links to navigate to find information specific to this specific data
archive let's click on the points resource link. This brings us to a page with all the
points configured for this PI Data Archive if we use control F we can search on this page for a
specific tag. Let's search for the sinusoid tag. We can see some basic configuration information
about the sinusoid tag here such as its point ID or what type of tag it's configured as.
Much like the data archive resource each point has a set of resource links that we can use to
find additional information. For example if we click on the value link we're brought to
a page which displays the current value of the sinusoid tag with a snapshot time along
with the typical event information such as if it's marked questionable or substituted. One
thing to note the PI Web API represents all timestamps as UTC whereas my client machine
is located in UTC minus 4 so we see the timestamp is a bit different than our current machine time.
Let's see what other information we can gather about this tag. If we click on the interpolated
data it will bring us to a new page. Here we see it brings up a number of values
with exactly one hour intervals. Without any additional information provided to it
the PI Web API assumes some defaults to make this interpolated data call. It will provide
interpolated values, every hour, from 24 hours ago until now. The recorded and plot data have
similar properties that we'll explore in later videos.
If we navigate back to the homepage and then to the asset service link we see we
get similar information to when we navigated to the data archive. If
we select the self link we can see the name and server versions here as well.
However this time instead of listing out the points we have the option to list out
the databases on the AF server. We can see our configuration database as well as our NuGreen
database. Within these databases we have the option to list the elements in the database.
You'll notice that this current list is only a list of the root elements on the database. If we
want to go down further in the AF hierarchy we'll need to select the elements on that root elements.
Once we found an element of interest we can list the attributes on this element. When
we do this we see additional information about each attribute configured for this element we
can see the configuration for this particular AF attribute and since it's configured as a PI point
data reference and as such we can like take a look at the archive data for this attribute.
In this video we got our first real look at the PI Web API. We used a browser, in my case Google
Chrome, to take a look at the PI Web API. We saw that the PI Web API is a series of URLs that
return information and links to other resources in JSON format. Because the PI Web API returns links
to other resources we don't necessarily need to know the exact URL for the resource we need
for our information in our applications. We can often take advantage of the PI Web API is links to
other resources in order to locate what we might need. We saw that we can query for information on
the PI Web API itself such as the configuration parameters and what authentication methods we're
using to connect. We can query for information on the data archive such as what points they have and
the values for those points. Similarly for the PI AF server we're able to navigate through the
hierarchy to see information about elements, attributes and the values of those attributes.
I recommend taking a few minutes to click around
in the PI Web API and a browser and get comfortable with the general structure
of the linking to other resources before moving on to the next video.