AnsweredAssumed Answered

How to update multiple tag values  in one shot using REST?

Question asked by CIQS on Apr 4, 2019
Latest reply on Mar 16, 2020 by nDimensional

Hi,

i'm struggling with updating multiple tag values in one request using the REST API.

1) for once, I'm not really sure whether to use the /streamsets/recorded or the /streamsets/value endpoint. Usually I would use the value endpoint as I only want to add a single new reading for each tag to update. I've tried both, though.

2) Whenever POSTing to the Web API I get a 415 Unsupported Media Type exception - which I would think means that my request body is wrong.

 

I've tried the following bodies:

[

  {

    "WebId": "F1DPW6Wlk0_Utku9vWTvxg45oACQAAAAUElTUlYxXEJBOkFDVElWRS4x",

    "Value": {

      "Timestamp": "2019-01-01T22:33:44Z",

      "Value": 12.3

    }

  },

  {

    "WebId": "F1DPW6Wlk0_Utku9vWTvxg45oACAAAAAUElTUlYxXEJBOkNPTkMuMQ",

    "Value": {

      "Timestamp": "2019-01-01T22:33:44Z",

      "Value": 12.3

    }

  }

]

 

and

 

[

  {

    "WebId": "F1DPW6Wlk0_Utku9vWTvxg45oACQAAAAUElTUlYxXEJBOkFDVElWRS4x",

    "Items": [

      {

        "Timestamp": "2014-07-22T14:00:00Z",

        "Value": 12.3

      }

    ]

  },

  {

    "WebId": "F1DPW6Wlk0_Utku9vWTvxg45oACAAAAAUElTUlYxXEJBOkNPTkMuMQ",

    "Items": [

      {

        "Timestamp": "2014-07-22T14:00:00Z",

        "Value": 12.3

      }

    ]

  }

]

 

with both endpoints:

https://devdata.osisoft.com/piwebapi/streamsets/recorded

https://devdata.osisoft.com/piwebapi/streamsets/value

 

The web ID exist on the Public PI server, I've sucessfully read them with this:

https://devdata.osisoft.com/piwebapi/streamsets/recordedattime?time=2019-04-01T12:55:33Z&retrievalMode=AtOrBefore&webId=…


Any idea what might be wrong? How can I get a better error message?

 

Many thanks! Christoph

Outcomes