web api call help

  • 231 Views
  • Last Post 01 December 2013
rkroboth posted this 01 December 2013

I had been using this curl command to get my list of devices:

curl -X PUT -H "Content-Type:application/json;charset=utf-8" -d "{}" http://192.168.1.10:1178/zwave/devices

Recently I updated my InControl app to version 3.48.5074.20109, and I believe after this update this curl command stopped working (although I'm not 100% sure it's related).

My other curl commands still work, for example this works fine:

curl -X PUT -H "Content-Type:application/json;charset=utf-8" -d "{}" http://192.168.1.10:1178/zwave/getScenes

When I try the "devices" command though, I just get this output (with the style tag truncated for brevity):

curl -X PUT -H "Content-Type:application/json;charset=utf-8" -d "{}" http://192.168.1.10:1178/zwave/devices




Service




Service


Method not allowed.






I've been using this api reference to know these calls: http://developer.incontrolha.com/json-api.aspx

Thanks for any guidance anybody has!

Order By: Standard | Newest | Votes
Ryan-Scott posted this 01 December 2013

I had been using this curl command to get my list of devices:

curl -X PUT -H "Content-Type:application/json;charset=utf-8" -d "{}" http://192.168.1.10:1178/zwave/devices

Recently I updated my InControl app to version 3.48.5074.20109, and I believe after this update this curl command stopped working (although I'm not 100% sure it's related).

My other curl commands still work, for example this works fine:

curl -X PUT -H "Content-Type:application/json;charset=utf-8" -d "{}" http://192.168.1.10:1178/zwave/getScenes

When I try the "devices" command though, I just get this output (with the style tag truncated for brevity):

curl -X PUT -H "Content-Type:application/json;charset=utf-8" -d "{}" http://192.168.1.10:1178/zwave/devices




Service




Service


Method not allowed.






I've been using this api reference to know these calls: http://developer.incontrolha.com/json-api.aspx

Thanks for any guidance anybody has!


The devices list should probably be a GET instead of a PUT - that should take care of it for you.

rkroboth posted this 01 December 2013

Ok this does help:

curl -X GET -H "Content-Type:application/json;charset=utf-8" -d "{}" http://192.168.1.10:1178/zwave/devices

but it just returns [], which I'm guessing means no devices? But I have about 10 devices on my network, they all show up and are manageable in my app, so I think they are correctly added to the controller. Is there a setting that hides them from the web services somehow?

Ryan-Scott posted this 01 December 2013

Ok this does help:

curl -X GET -H "Content-Type:application/json;charset=utf-8" -d "{}" http://192.168.1.10:1178/zwave/devices

but it just returns [], which I'm guessing means no devices? But I have about 10 devices on my network, they all show up and are manageable in my app, so I think they are correctly added to the controller. Is there a setting that hides them from the web services somehow?


Have you got a server password setup? If so and you don't enter it, you'll get an empty list. You can add a ?password=something at the end of the url.

rkroboth posted this 01 December 2013

No I don't, this is all on my internal network. If I did, the getScenes command would not work, right? Here's my getScenes curl command:

curl -X PUT -H "Content-Type:application/json;charset=utf-8" -d "{}" http://192.168.1.10:1178/zwave/getScenes

[{"enabled":true,"mobileVisible":true,"sceneConditionsRaw":null,"sceneId":"42d24b44-def0-4532-abf6-ff623613dc30","sceneName":"Garage Door","sceneTriggersRaw":null,"scriptName":null,"scriptNamePost":null},{"enabled":true,"mobileVisible":true,"sceneConditionsRaw":null,"sceneId":"134c9391-6e0d-4ccc-ba51-76517d1ab127","sceneName":"Outside lights off","sceneTriggersRaw":null,"scriptName":null,"scriptNamePost":null},{"enabled":true,"mobileVisible":true,"sceneConditionsRaw":null,"sceneId":"9e531bea-17de-44d3-bd02-3b8c16c90660","sceneName":"Outside lights on","sceneTriggersRaw":null,"scriptName":null,"scriptNamePost":null}]

and here's my /devices command:

curl -X GET -H "Content-Type:application/json;charset=utf-8" -d "{}" http://192.168.1.10:1178/zwave/devices

[]

rkroboth posted this 01 December 2013

Actually - I just tried using the password I entered on the InControl software "options" screen under the "Connection" tab. And that allows my /devices API call to work.

I guess I was thrown off because it looks like that screen is for the Direct Connect server, not the API. And even when it's set, the "getScenes" API calls still work without the password.

It might make sense if you added a "Web API port" text field to that screen, so it's more obvious the password applies to both the Direct Connect and the API server. And it would be nice to be able to configure the web api port anyway.

Also, it seems like if the password is required for the /devices call, then it should be required for all the api calls too, like the "getScenes" call.

Thanks!

Close