2015 OSIsoft TechCon
[Pages:10]2015 OSIsoft TechCon Code with REST
using the PI Web API
1|Page
Table of Contents Contents
Table of Contents.......................................................................................................................................... 1 Lab Overview ................................................................................................................................................ 2
Objectives ................................................................................................................................................. 2 Setup ......................................................................................................................................................... 2 Challenge................................................................................................................................................... 2 Introduction to the PI Web API and Indexed Search .................................................................................... 3 Introduction to the Demo Application.......................................................................................................... 5 GET Elements Using an Indexed Search Query............................................................................................. 6 GET an Element's Attributes ......................................................................................................................... 6 GET the Current Value .................................................................................................................................. 6 GET Stream Values ........................................................................................................................................ 6 Appendix: Replicating the Lab Environment................................................................................................. 7 OSIsoft Virtual Learning Environment .......................................................................................................... 8
1|Page
2015 TechCon Session
Lab Overview
In this lab, you'll learn the core concepts of the PI Web API and Indexed Search and apply these concepts by developing the data access layer of a simple web application. Basic familiarity with PI AF and HTML/CSS/JavaScript will be helpful.
Objectives
At the end of this lab, you should be able to: ? Describe how the PI Web API maps the PI AF object model to a RESTful interface. ? Describe how Indexed Search indexes and retrieves PI AF objects. ? Perform basic queries against Indexed Search. ? Read PI AF elements and attributes and PI data using the PI Web API. ? Apply these concepts and recipes to real applications.
Setup
This lab assumes the following setup: ? Running instances of PI AF, PI Data Archive, PI Web API, and Indexed Search. ? A populated PI AF database that has been indexed by Indexed Search.
Challenge
In the first part of the lab, you'll learn how PI AF objects are exposed by a RESTful interface by exploring an asset hierarchy using the PI Web API in a browser. Next, you'll learn about the Indexed Search service by constructing several queries of your own in the browser. Finally, you'll apply these lessons by creating the data access layer of a simple PI System visualization web application.
2|Page
Introduction to the PI Web API and Indexed Search
Introduction to the PI Web API and Indexed Search
1. Visit the getting started guide that's hosted as part of the online help, at . Read the first 8 sections (through The Structure of a PI Web API Request). While you're reading this content, open in another window. You can use this HTML-based interface to browse data exposed by the PI Web API.
Figure 1: Online Help - Getting Started Guide
Figure 2: The PI Web API HTML interface allows you to browse the linked structure of the object model. It also provides links to the relevant hosted help pages.
3|Page
2015 TechCon Session
2. Visit the Indexed Search component of the PI Web API, at . By following the Sources link, you can view the indexed AF database. The Query link is the endpoint you should use when performing searches. The other links provide version information, service metrics, and so on.
3. Visit the Query link. Note that you receive an error message stating that a query parameter must be specified. Visit the link to the documentation for this method to learn how to specify a query parameter and other search options. Combine this information with your knowledge of the database that we've indexed for this lab to construct a few queries that will return meaningful results, like the one shown below.
Figure 3: Search results for a query on an instance of the NuGreen database.
Indexed Search generates these results by treating PI AF objects as documents and performing a text search on these documents using the supplied keywords and options. Each PI AF element corresponds to a document, constructed of the element's name, description, and so on, as well as its child attributes. These documents are indexed and queried using Lucene, a popular information retrieval library.
4|Page
Introduction to the Demo Application
Introduction to the Demo Application
To put these concepts into practice, you'll build a Double Deluxe Data Dashboard visualization web application, using the PI Web API for data access. The finished product will look something like this:
Figure 4: A screenshot from the application you'll be building.
This is an HTML/CSS/JavaScript application that supports basic dashboard-building functionality, including element search and the ability to drag and drop attribute values and trends in the dashboard area. The layout and styling, as well as the JavaScript that supports the UI, has been provided. Your task is to fill in the data access layer with appropriate calls to the PI Web API. The code is organized like this: /demo ? index.html ? HTML layout ? /style
o style.css ? CSS styling ? /js
o data.js ? data access layer; all of your modifications belong in this file o datasolution.js ? reference solution o dragdrop.js ? HTML5 drag and drop support o index.js ? basic window setup o render.js ? UI support
5|Page
2015 TechCon Session
GET Elements Using an Indexed Search Query
Complete the search function in data.js. The expected behavior is documented in the file.
GET an Element's Attributes
Complete the getAttributes function in data.js.
GET the Current Value
Complete the getValue function in data.js.
GET Stream Values
Complete the getStreamValues function in data.js.
6|Page
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- native json datatype support maturing sql and nosql
- advanced sql injection
- a beginners guide to consuming restful web services in sas
- maximo 76 scripting features bruno portaluri
- introduction to server side programming
- working with json in rpg scott klement
- web scraping with stanford
- web security model stanford university
- cs 142 midterm examination stanford university
- oracle forms services secure document calls
Related searches
- 2015 2016 stock market graph
- best 2015 used cars
- 2015 snow storms in massachusetts
- 2015 o l results
- 2015 toyota highlander gps upgrade
- watch perfect guy 2015 full movie online
- dow jones 2015 to present
- amazon 2015 net income
- 2015 o l exam result
- marriage equality act 2015 united states
- word 2015 free full version
- 2015 toyota highlander gps update