Closed RomanGmprln closed 3 years ago
I am just learning about Alpaca and don't look at Alpaca issues very often. Sorry that your issue has generated any comments until now. From the Alpaca API documentation: For GET operations, parameters should be placed in the URL query string and for PUT operations they should be placed in the body of the message. The SetSwitch value is a PUT operation, so the id, value, ClientID, and ClientTransactionID values should go in the body of the request, not in the query string. Hopefully, Peter or Daniel will add to this if my info is incorrect or imcomplete.
Hi Roman,
I tried out your CURL request:
curl -X PUT "https://virtserver.swaggerhub.com/ASCOMInitiative/api/v1/switch/0/setswitchvalue" -H "accept: application/json" -H "Content-Type: application/x-www-form-urlencoded" -d "Id=&Value=2.0&ClientID=0&ClientTransactionID=1234"
and value for Id is missing, the CURL string should include something like Id=0. It worked fine here when I made this change and tested it against an ASCOM Remote Server instance.
Sadly, SmartBear have a bug in their system that currently prevents our virtserver.swaggerhub.com instance from working and always returns a 500 HTTP error.
Your best bet for debugging, if you have access to a WIndows PC, is to install the ASCOM Remote Server and configure it to serve the Platform's Switch simulator.
Sorry for the long delay in replying
Best wishes, Peter
Hello,
I am trying to control a ASCOM Alpaca Switch device. The device supports multiple switchvalues: [0.0, 1.0, 2.0]
On setting a new switchvalue (eg. to 2.0 ) in N.I.N.A., the http request URL lacks the “Value=2.0“. (see log line 58))
/api/v1/switch/0/setswitchvaluewhere I am expecting:
/api/v1/switch/0/setswitchvalue?Value=2.0&ClientTransactionID=XXXX&ClientID=XXXX&ID=0
Looking at the log, I see the other requests are correct and do also contain a ClientTransaction and ClientID. Where the ‘setswitchvalue’ PUT request does not provide a 'Value’. The ClientTransactionID is internally incremented but not added to the request URL. (compare log line 55, 58 and 61).
Trying it out on: https://ascom-standards.org/api/#/Switch%20Specific%20Methods/put_switch__device_number__setswitchvalue
it seems to me, that the Alpaca API reference does not provide the correct request string. Where the exemplary curl string has the Value
curl -X PUT "https://virtserver.swaggerhub.com/ASCOMInitiative/api/v1/switch/0/setswitchvalue" -H "accept: application/json" -H "Content-Type: application/x-www-form-urlencoded" -d "Id=&Value=2.0&ClientID=0&ClientTransactionID=1234" the generated request URL lacks the Value and IDs:
https://virtserver.swaggerhub.com/ASCOMInitiative/api/v1/switch/0/setswitchvalue
Am I missing something here or is this a bug in URL assembling?
LOG (Line 1-57 show the correct device connection and parameter queries, line 58 has the setswitchvalue request URL in question):