opcapi panic: unknown type
Choucky opened this issue · 2 comments
I installed OPC API to test reading and writing in tags. I can read my tags without problems.
But I have an error when I want to write in a tag with opcapi.
I launch an HTTP request with a PUT method and the following json:
{"Value": "mavalue", "type": "VT_BSTR"}.
I get this error: http: panic serving **: unkown type.
Is this the right way to call this API ?
@Choucky for the PUT method you just need to provide the value in the http body, i.e. use only '"myvalue"'.
I just tested the following example with the Graybox Simulation OPC server:
$ curl -X POST localhost:8765/tag -d '["storage.string.reg01"]'
{"result":"created"}
$ curl -X GET localhost:8765/tags
{"storage.string.reg01":{"Value":"Hello","Quality":216,"Timestamp":"2020-03-24T09:54:28Z"}}
$ curl -X PUT localhost:8765/tag/storage.string.reg01 -d '"World"'
{"result":"updated"}
$ curl -X GET localhost:8765/tags
{"storage.string.reg01":{"Value":"World","Quality":216,"Timestamp":"2020-03-24T09:56:08Z"}}
@Choucky for the PUT method you just need to provide the value in the http body, i.e. use only '"myvalue"'.
I just tested the following example with the Graybox Simulation OPC server:
$ curl -X POST localhost:8765/tag -d '["storage.string.reg01"]' {"result":"created"} $ curl -X GET localhost:8765/tags {"storage.string.reg01":{"Value":"Hello","Quality":216,"Timestamp":"2020-03-24T09:54:28Z"}} $ curl -X PUT localhost:8765/tag/storage.string.reg01 -d '"World"' {"result":"updated"} $ curl -X GET localhost:8765/tags {"storage.string.reg01":{"Value":"World","Quality":216,"Timestamp":"2020-03-24T09:56:08Z"}}
Thanks
I make a put request in postman and put value in body. It's works !