I am presently trying to use the REST endpoint to communicate with a SNAP-PAC-R1. I’ve successfully done this in the past, but something seems to have changed and I’m not sure what.
I can successfully query the output (Spare2) that I want to adjust with the following query:
GET http://[ip address]/api/v1/device/strategy/ios/digitalOutputs/Spare2/state
▼
Headers
(2)
> content-type:application/json
> Authorization:Basic [encoded credentials]
It returns the following perfectly cromulent JSON:
{
"value": false
}
However, if I attempt to alter the value of the same point with this query:
POST http://[ip address]/api/v1/device/strategy/ios/digitalOutputs/Spare2/state
Headers
(2)
> content-type:application/json; charset=UTF-8
> Authorization:Basic [encoded credentials]
Body
{
"value": true
}
I am receiving the following error:
{
"errorCode": -8,
"message": "See Opto 22 documentation for error code descriptions."
}
According to the API documentation:
"-8 ** Invalid data. Check format of data written. Compare to what’s read for the same endpoint. "
Which I find interesting, because I literally cut and pasted the response from the first query to create the body for the second one.
The weird thing is - this worked as recently as yesterday, but it no longer does, and I can’t quite figure out what’s changed. I’ve been trying to talk to the same box using MODBUS, so I suppose the communication circuits may have gotten confused, but I have redownloaded the entire strategy and restarted the box several times, with no change in results.
Any thoughts on why it’s suddenly stopped working, or what I can do to get it back in working order?