LOGIN  |  REGISTER
Smart Living Made Brilliant!
CASTLEOS FORUM

HomeCastleOS API

Information, FAQs, Q&As, and everything else related to the CastleOS API can be found here

Web: Errors return XML not JSON Messages in this topic - RSS

Phil Hawthorne
Phil Hawthorne
Posts: 400


3/13/2016
Phil Hawthorne
Phil Hawthorne
Posts: 400
Just trying to get my PHP wrapper to get a token from /CastleOS/service/web/AuthenticateUser_PlainText

The headers from the server state that the response body is JSON, however the actual response is XML, with a note saying


Method not allowed. Please see the service help page for constructing valid requests to the service.


The service help page, also has the same problem. Headers specify JSON, but HTML is returned.

The help page should be in HTML, but any errors given back to the caller should be in JSON, so they can be handled programmatically.
0 link
Chris Cicchitelli
Chris Cicchitelli
Administrator
Posts: 3390


3/13/2016
Chris Cicchitelli
Chris Cicchitelli
Administrator
Posts: 3390
If it was giving you a response from the method, it would be JSON, but it seems like it's throwing an error instead and the method is never actually hit. Sounds like it's not connecting to the service? Does GetApplicationTitle work?
0 link
Phil Hawthorne
Phil Hawthorne
Posts: 400


3/13/2016
Phil Hawthorne
Phil Hawthorne
Posts: 400
Yes, call to GetApplicationTitle returns

"CastleOS"

It seems I have something wrong. The error came up when I called the following URL

ToggleGroupPower?groupId=4&power=1

But when I did

ToggleGroupPower?groupId=4&power=true

No error was thrown. So it seems, if the expected data is not in the right format, that error is thrown. The trick is, working out what the data should be in
0 link
Chris Cicchitelli
Chris Cicchitelli
Administrator
Posts: 3390


3/13/2016
Chris Cicchitelli
Chris Cicchitelli
Administrator
Posts: 3390
Yup, you'll have to use the docs I sent to see the expected format...
0 link