Selected Fields (Core Services)

The selectedFields parameter filters PI Web API response so that the response only includes a selected set of fields. It allows PI Web API to return none but the information that you are interested in, and therefore reduce your bandwidth usage.

The following examples explain the syntax for the selected fields. Supposedly, we have this JSON response with all fields returned.

{
  "Links": {
    "Link1": "https://localhost/link1",
    "Link2": "https://localhost/link2"
  },
  "Items": [
    {
      "WebId": "I1AbEDqD5loBNH0erqeqJodtALA9iLxz4m_5RGAxgAVXYUACw_yrS377vX0uZVHTgkanusw",
      "Name": "Water",
      "Links": {
        "Self": "https://localhost/piwebapi/attributes/I1AbEDqD5loBNH0erqeqJodtALA9iLxz4m_5RGAxgAVXYUACw_yrS377vX0uZVHTgkanusw"
      },
      "Value": {
        "Timestamp": "2016-02-22T13:00:50Z",
        "Value": 230.3,
        "UnitsAbbreviation": "m3",
        "Good": "true",
        "Questionable": "false",
        "Substituted": "false"
      }
    },
    {
      "WebId": "I1AbEDqD5loBNH0erqeqJodtALAtcdBko_F5xGTpFCaTFd2TwRQESrwf1o0iQUMxYbzNaDg",
      "Name": "Electricity",
      "Links": {
        "Self": "https://localhost/piwebapi/attributes/I1AbEDqD5loBNH0erqeqJodtALAtcdBko_F5xGTpFCaTFd2TwRQESrwf1o0iQUMxYbzNaDg"
      },
      "Value": {
        "Timestamp": "2016-02-22T13:01:02Z",
        "Value": 56.4,
        "UnitsAbbreviation": "kW",
        "Good": "true",
        "Questionable": "false",
        "Substituted": "false"
      }
    }
  ]
}

Response when selectedFields=Links is applied:

{
  "Links": {
    "Link1": "https://localhost/link1",
    "Link2": "https://localhost/link2"
  }
}

Response when selectedFields=Links.Link1;Links.LinkTwo is applied:

{
  "Links": {
    "Link1": "https://localhost/link1"
  }
}

Response when selectedFields=Items.WebId;Items.Value.Timestamp;Items.Value.Value is applied:

{
  "Items": [
    {
      "WebId": "I1AbEDqD5loBNH0erqeqJodtALA9iLxz4m_5RGAxgAVXYUACw_yrS377vX0uZVHTgkanusw",
      "Value": {
        "Timestamp": "2016-02-22T13:00:50Z",
        "Value": 230.3,
      }
    },
    {
      "WebId": "I1AbEDqD5loBNH0erqeqJodtALA9iLxz4m_5RGAxgAVXYUACwAujaqyu-eUKJANgL5jOe0A",
      "Value": {
        "Timestamp": "2016-02-22T13:01:02Z",
        "Value": 56.4,
      }
    }
  ]
}
Enabling Operational Intelligence