Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • consistent use of camel case. Where some PI-XML elements start with a upperCase, the camelCase convention is used for all JSON objects. For example the timeSeries.xsd of PI-XML defines the root element as TimeSeries. In PI-JSON it is called timeSeries. All JSON properties use the camelCase convention.
  • Implicit object names are left out. For example in the timeSeries.xsd of PI-XML timeSeries is defined as a sequence of series elements. In PI-JSON the element "series" is left out.
  • Values are always quoted.
  • XML attributes are transformed to JSON properties.

Examples

...

Python Example

PI-JSON can be easily read using Python. The following example shows how to read PI-JSON timeseries using the requests module. The result contains a dictionary with timeSeries.

Code Block
languagepy
import requests
 
url = 'http://localhost:8181/FewsWebServices/rest/fewspiservice/v1/timeseries'

params = dict(
    documentVersion='1.23',
    documentFormat='PI_JSON'
)

params = dict(
    documentVersion='1.23',
    documentFormat='PI_JSON',
    showThresholds='true',
    omitMissing='true',
    onlyHeaders='false',
    showEnsembleMemberIds='false',
    showStatistics='true'

)

response = requests.get(url=url, params=params)
data = response.json()

print('All timeSeries:', data)