AnsweredAssumed Answered

PI Web API Returns Nested Values

Question asked by TamLe on Jun 27, 2018
Latest reply on Jun 27, 2018 by Roger Palmen

When querying the PI Web API some values are nested and some aren't for the same attribute but different element. How do you determine when an value is going to be nested to create dynamic calls to determine how to handle the data returned? Here's an example of the data returned where the paths are structured the same.

 

  "Links": {},

  "Items": [

    {

      "WebId": "Plant1WebID",

      "Name": "WindSpeed",

      "Path": "\\\\server\\SoCo\\Generation\\SPC\\Solar\\Plant1|WindSpeed",

      "Links": {

        "Source": "https://spc-pi.southernco.com/piwebapi/attributes/Plant1WebID"

      },

      "Value": {

        "Timestamp": "2018-06-27T12:05:14Z",

        "Value": 0.0,

        "UnitsAbbreviation": "m/s",

        "Good": true,

        "Questionable": false,

        "Substituted": false

      }

    }

 

 

 

 

  "Links": {},

  "Items": [

    {

      "WebId": "Plant2WebID",

      "Name": "WindSpeed",

      "Path": "\\\\server\SoCo\\Generation\\SPC\\Solar\\Plant2|WindSpeed",

      "Links": {

        "Source": "https://spc-pi.southernco.com/piwebapi/attributes/Plant2WebID"

      },

      "Value": {

        "Timestamp": "2017-04-12T22:11:38Z",

        "Value": {

          "Name": "Pt Created",

          "Value": 253,

          "IsSystem": true

        },

        "UnitsAbbreviation": "",

        "Good": false,

        "Questionable": false,

        "Substituted": false

      }

    }

Outcomes