If you're using the old REST API (which has been deprecated), here are some examples of how you might convert your REST usages to the HTTP API.
The first thing you'll want to understand is how to use authentication with the HTTP API. The examples below use both headers and query args for authentication. You can use whichever works for you. You should replace YOUR-API-KEY
with your actual API Key.
Second, all replies to the API will be JSON messages.
In the following examples, we'll be using a mix of authentication headers and the API Key as a query arg. You can use either. We mark the examples REST (old REST API) and HTTP (newer HTTP API).
http://username:password@127.0.0.1:8176/devices.json
http://127.0.0.1:8176/v2/api/indigo.devices?api-key=YOUR-API-KEY
This will return a JSON list of Device Objects.
http://username:password@127.0.0.1:8176/devices/office-lamp.json
http://127.0.0.1:8176/v2/api/indigo.devices/123456789?api-key=YOUR-API-KEY
Insert the ID of the office-lamp
device rather than the name. Note you can quickly copy the device ID to the clipboard by right-clicking on the device in Indigo app's main window and choosing the Copy ID
context menu.
This will return a single Device Object.
Sending commands to devices requires that you POST a JSON message to the /v2/api/command
URL.
''curl -X PUT -u user:password --digest -d brightness=27 http://127.0.0.1:8176/devices/office-lamp''
curl -X POST -H "Authorization: Bearer YOUR-API-KEY" -d '{"message":"indigo.device.setBrightness","objectId":123456789,"parameters":{"value":27}}' http://127.0.0.1:8176/v2/api/command
Insert the ID of the office-lamp
device as the objectId.
''curl -X PUT -u user:password --digest -d isOn=1 http://127.0.0.1:8176/devices/office-lamp''
''curl -X PUT -u user:password --digest -d isOn=0 http://127.0.0.1:8176/devices/office-lamp''
curl -X POST -H "Authorization: Bearer YOUR-API-KEY" -d '{"message":"indigo.device.turnOn","objectId":123456789}' http://127.0.0.1:8176/v2/api/command
curl -X POST -H "Authorization: Bearer YOUR-API-KEY" -d '{"message":"indigo.device.turnOff","objectId":123456789}' http://127.0.0.1:8176/v2/api/command
Insert the ID of the office-lamp
device as the objectId.
''curl -X PUT -u user:password --digest -d toggle=1 http://127.0.0.1:8176/devices/office-lamp''
curl -X POST -H "Authorization: Bearer YOUR-API-KEY" -d '{"message":"indigo.device.toggle","objectId":123456789}' http://127.0.0.1:8176/v2/api/command
Insert the ID of the office-lamp
device as the objectId.
These examples will set device office-ceiling-fan
to 0 (off), then set to 3 (high), then decrease back to 0 (off).
''curl -X PUT -u user:password --digest -d speedIndex=0 http://127.0.0.1:8176/devices/office-ceiling-fan''
''curl -X PUT -u user:password --digest -d speedIndex=3 http://127.0.0.1:8176/devices/office-ceiling-fan''
''curl -X PUT -u user:password --digest -d speedIndex=dn http://127.0.0.1:8176/devices/office-ceiling-fan''
''curl -X PUT -u user:password --digest -d speedIndex=dn http://127.0.0.1:8176/devices/office-ceiling-fan''
''curl -X PUT -u user:password --digest -d speedIndex=dn http://127.0.0.1:8176/devices/office-ceiling-fan''
curl -X POST -H "Authorization: Bearer YOUR-API-KEY" -d '{"message":"indigo.speedcontrol.setSpeedIndex","objectId":123456789,"parameters":{"value":0}}' http://127.0.0.1:8176/v2/api/command
curl -X POST -H "Authorization: Bearer YOUR-API-KEY" -d '{"message":"indigo.speedcontrol.setSpeedIndex","objectId":123456789,"parameters":{"value":3}}' http://127.0.0.1:8176/v2/api/command
curl -X POST -H "Authorization: Bearer YOUR-API-KEY" -d '{"message":"indigo.speedcontrol.decreaseSpeedIndex","objectId":123456789}' http://127.0.0.1:8176/v2/api/command
curl -X POST -H "Authorization: Bearer YOUR-API-KEY" -d '{"message":"indigo.speedcontrol.decreaseSpeedIndex","objectId":123456789}' http://127.0.0.1:8176/v2/api/command
curl -X POST -H "Authorization: Bearer YOUR-API-KEY" -d '{"message":"indigo.speedcontrol.decreaseSpeedIndex","objectId":123456789}' http://127.0.0.1:8176/v2/api/command
Insert the ID of the office-ceiling-fan
device as the objectId.
These examples will change device irrmaster-pro
active sprinkler zone to 3 and all off.
''curl -X PUT -u user:password --digest -d activeZone=3 http://127.0.0.1:8176/devices/irrmaster-pro''
''curl -X PUT -u user:password --digest -d activeZone=0 http://127.0.0.1:8176/devices/irrmaster-pro''
curl -X POST -H "Authorization: Bearer YOUR-API-KEY" -d '{"message":"indigo.sprinkler.setActiveZone","objectId":123456789,"parameters":{"index":3}}' http://127.0.0.1:8176/v2/api/command
curl -X POST -H "Authorization: Bearer YOUR-API-KEY" -d '{"message":"indigo.sprinkler.setActiveZone","objectId":123456789,"parameters":{"index":0}}' http://127.0.0.1:8176/v2/api/command
Insert the ID of the irrmaster-pro
device as the objectId.
These examples will set device thermostat
's heat and cool setpoints
''curl -X PUT -u user:password --digest -d setpointCool=76 http://127.0.0.1:8176/devices/thermostat''
''curl -X PUT -u user:password --digest -d setpointHeat=70 http://127.0.0.1:8176/devices/thermostat''
Increase Heat Setpoint
''curl -X PUT -u user:password --digest -d setpointHeat=up http://127.0.0.1:8176/devices/thermostat''
curl -X POST -H "Authorization: Bearer YOUR-API-KEY" -d '{"message":"indigo.thermostat.setCoolSetpoint","objectId":123456789,"parameters":{"value":76}}' http://127.0.0.1:8176/v2/api/command
curl -X POST -H "Authorization: Bearer YOUR-API-KEY" -d '{"message":"indigo.thermostat.setHeatSetpoint","objectId":123456789,"parameters":{"value":70}}' http://127.0.0.1:8176/v2/api/command
Increase Heat Setpoint
curl -X POST -H "Authorization: Bearer YOUR-API-KEY" -d '{"message":"indigo.thermostat.increaseHeatSetpoint","objectId":123456789}' http://127.0.0.1:8176/v2/api/command
Insert the ID of the thermostat
device as the objectId.
These examples will set device thermostat
's mode to “cool on” and “auto on”
''curl -X PUT -u user:password --digest -d hvacCurrentMode="cool on" http://127.0.0.1:8176/devices/thermostat''
''curl -X PUT -u user:password --digest -d hvacCurrentMode="auto on" http://127.0.0.1:8176/devices/thermostat''
curl -X POST -H "Authorization: Bearer YOUR-API-KEY" -d '{"message":"indigo.thermostat.setHvacMode","objectId":123456789,"parameters":{"value":"indigo.kHvacMode.Cool"}}' http://127.0.0.1:8176/v2/api/command
curl -X POST -H "Authorization: Bearer YOUR-API-KEY" -d '{"message":"indigo.thermostat.setHvacMode","objectId":123456789,"parameters":{"value":"indigo.kHvacMode.HeatCool"}}' http://127.0.0.1:8176/v2/api/command
Insert the ID of the thermostat
device as the objectId.
These examples will set device thermostat
's fan mode to “always on” and “auto on”
''curl -X PUT -u user:password --digest -d hvacFanMode="always on" http://127.0.0.1:8176/devices/thermostat''
''curl -X PUT -u user:password --digest -d hvacFanMode="auto on" http://127.0.0.1:8176/devices/thermostat''
curl -X POST -H "Authorization: Bearer YOUR-API-KEY" -d '{"message":"indigo.thermostat.setFanMode","objectId":123456789,"parameters":{"value":"indigo.kFanMode.AlwaysOn"}}' http://127.0.0.1:8176/v2/api/command
curl -X POST -H "Authorization: Bearer YOUR-API-KEY" -d '{"message":"indigo.thermostat.setFanMode","objectId":123456789,"parameters":{"value":"indigo.kFanMode.Auto"}}' http://127.0.0.1:8176/v2/api/command
Insert the ID of the thermostat
device as the objectId.
http://username:password@127.0.0.1:8176/variables.json
http://127.0.0.1:8176/v2/api/indigo.variables?api-key=YOUR-API-KEY
This will return a JSON list of Variable Objects.
http://username:password@127.0.0.1:8176/variables/sprinklerDurationMultiplier.json
http://127.0.0.1:8176/v2/api/indigo.variables/123456789?api-key=YOUR-API-KEY
Insert the ID of the sprinklerDurationMultiplier
variable rather than the name.
This will return a single Variable Object.
Sending commands to the server requires that you POST a JSON message to the /v2/api/command
URL.
''curl -X PUT -u user:password --digest -d value=1.23 http://127.0.0.1:8176/variables/sprinklerDurationMultiplier''
curl -X POST -H "Authorization: Bearer YOUR-API-KEY" -d '{"message":"indigo.variable.updateValue","objectId":123456789,"parameters":{"value":"1.23"}}' http://127.0.0.1:8176/v2/api/command
Insert the ID of the sprinklerDurationMultiplier
variable as the objectId. Note: variable values are always strings to make sure to enclose the value in quotes.
http://username:password@127.0.0.1:8176/actions.json
http://127.0.0.1:8176/v2/api/indigo.actionGroups?api-key=YOUR-API-KEY
This will return a JSON list of Action Group Objects.
http://username:password@127.0.0.1:8176/actions/party%20scene.json
http://127.0.0.1:8176/v2/api/indigo.actionGroups/123456789?api-key=YOUR-API-KEY
Insert the ID of the party scene
action group rather than the name.
This will return a single Action Group Object.
Sending commands to the server requires that you POST a JSON message to the /v2/api/command
URL.
''curl -X EXECUTE -u user:password --digest -d value=1.23 http://127.0.0.1:8176/actions/party%20scene''
curl -X POST -H "Authorization: Bearer YOUR-API-KEY" -d '{"message":"indigo.actionGroup.execute","objectId":123456789}' http://127.0.0.1:8176/v2/api/command
Insert the ID of the party scene
action group as the objectId.