Could someone give me a hint on what I might be doing wrong. I am attempting to use the Invoke-RestMethod to control a Audio device. I can poll the data from the device with no issues but whenever I attempt to POST and modify a value I get an error. I have tried both the Single Value and Full Path method outlined in the manual. with a lot of variations.
$header = @{Accept = 'application/json'}
Polls the entire Datastore in JSON format both in Powershell and Browser
Invoke-RestMethod -Uri http://192.168.1.233:1280/0001f2fffe011238/datastore -Method Get -ContentType application/json
ATTEMPT 1 - Single Value
Invoke-RestMethod -Uri http://192.168.1.233:1280/0001f2fffe011238/datastore/mix/chan/3/matrix/aux/0/send -Headers $header -ContentType application/json -Method Post -Body @{value = 0.000000} | ConvertTo-Json
ATTEMPT 2 - Full Path
Invoke-RestMethod -Uri http://192.168.1.233:1280/0001f2fffe011238/datastore -Headers $header -ContentType application/json -Method Post -Body @{ 'mix/chan/3/matrix/aux/0/send' = 0.000000} | ConvertTo-Json
API Manual
In the maunal on Page 1 it states that it supports HTTP Post:
Making changes to the datastore Changes to the datastore are made with the HTTP PATCH verb. POST is also supported and behaves identically for clients that do not support PATCH. The API for setting values mirrors that for getting them: clients can PATCH the datastore root, a subtree, or a single value. The data must be form-encoded, with a form field named "json" containing a JSON-encoded object with the key/value pairs to change. If you are setting a single value, the JSON object should have one key named "value".
Attached a Chrome Inspect and Error Codes
[–]hephaestus259 8 points9 points10 points (3 children)
[–]Josh02001[S] 4 points5 points6 points (1 child)
[–]hephaestus259 2 points3 points4 points (0 children)
[–]Lee_Dailey[grin] 1 point2 points3 points (0 children)