jorgewong

PI Web API - Post a tag of type Digital State

Discussion created by jorgewong on Dec 3, 2014
Latest reply on Dec 3, 2014 by jorgewong

Hello,

 

 

 

I'm trying to set a value for a PI tag that is a digital state.  I'm posting the following but getting a bad request error back.  It doesn't' give me much else to go on.  I'm assuming its probably my message that I'm posting.  I'm fine posting anything else that is not a digital state.  Any help is appreciated.

 

 

 

Here are some of the details of my post:

 

 

 

Path : https://server/piwebapi/streams/P0WvDSaT8pY0uGA4is91RAcQtlkDAAQ0dZTVNBUFNDMDA1RFxKRjFfQTMwMDBfV0FDX1BPTF9SRUdFTl9TSUdIVF9HTEFTUw/value?updateOption=Replace&bufferOption=DoNotBuffer

 

Tag Value: { Timestamp = {01/12/2014 4:20:25 PM}, Value = {   "Name": "1",   "Value": "0" } } 

 

 

 

Request Message:

 

{Method: POST, RequestUri:

 

 

 

'https://server/piwebapi/streams/P0WvDSaT8pY0uGA4is91RAcQtlkDAAQ0dZTVNBUFNDMDA1RFxKRjFfQTMwMDBfV0FDX1BPTF9SRUdFTl9TSUdIVF9HTEFTUw/value?updateOption=Replace&bufferOption=DoNotBuffer', Version: 1.1, Content: System.Net.Http.ObjectContent`1[[<>f__AnonymousType5`2[[System.DateTime, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], PIWebWrapper, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], Headers:{  Accept: application/json  Content-Type: application/json; charset=utf-8  Content-Length: 74}}

 

 

 

 

 

Error:

 

{StatusCode: 400, ReasonPhrase:

 

 

 

 

 

 

 

'Bad Request', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:{  Date: Wed, 03 Dec 2014 17:26:36 GMT  Server: Microsoft-HTTPAPI/2.0  Content-Length: 71  Content-Type: application/json; charset=utf-8}}

 

 

 

 

 

The digital set consists of 4 states:

 

State | State Name

 

0 | 1

 

1 | 2

 

2 | 3

 

3 | 4

 

 

 

 

Outcomes