API

The API is currently WIP and under active development. You can follow the implementation here: https://github.com/adrianjost/SmartLight-IFTTT-Google-Home-Adapter/issues/8

/units

get
List All Units

/units
This lists all units of the given user
Request
Response
Request
Headers
authorization-token
required
string
the api token the user can generate in the frontend
authorization-userid
required
string
the userid the user can find in the frontend
Response
200: OK
Returns a JSON Object with the status code and the data or an error description
{
"status": 200,
"data": [
{
"state": {
"gradient": false,
"color": "#ff00ff"
},
"name": "Bett",
"id": "someId",
"tags": ["a Tag"],
"created_at": {
"_seconds": 1578148014,
"_nanoseconds": 796000000
},
"updated_at": {
"_seconds": 1578148482,
"_nanoseconds": 521000000
},
"ip": "192.168.1.233",
"channelMap": {
"b": 1,
"r": 2,
"g": 3
},
"updated_by": "userId",
"type": "LAMP", // or GROUP
"icon": "some-icon",
"lamptype": "RGB", // or WWCW
"created_by": "userId",
"hostname": "some-hostname"
}
// ...
]
}
404: Not Found
{
"status": 404,
"error": "unit not found"

get
Get Unit Details

/unit/:id
Request
Response
Request
Headers
authorization-token
required
string
authorization-userid
required
string
Response
200: OK
{
"status": 200,
"data": {
"state": {
"gradient": false,
"color": "#ff00ff"
},
"name": "Bett",
"id": "someId",
"tags": ["a Tag"],
"created_at": {
"_seconds": 1578148014,
"_nanoseconds": 796000000
},
"updated_at": {
"_seconds": 1578148482,
"_nanoseconds": 521000000
},
"ip": "192.168.1.233",
"channelMap": {
"b": 1,
"r": 2,
"g": 3
},
"updated_by": "userId",
"type": "LAMP", // or GROUP
"icon": "some-icon",
"lamptype": "RGB", // or WWCW
"created_by": "userId",
"hostname": "some-hostname"
}
}

patch
Update Unit (State)

/units/:id
Request
Response
Request
Headers
authorization-token
required
string
authorization-userid
required
string
Body Parameters
token
optional
string
Can be used
token
optional
string
of the header field
userid
optional
string
Can be used instead of the header field
payload
required
object
the new unit, also can be incomplete. The payload will be merged with the existing entry.
Response
200: OK
{
"status": 200,
"data": {
// the new unit object
}
}

delete
Delete a Unit

/units/:id
Request
Response
Request
Headers
authorization-userid
required
string
authorization-token
required
string
Response
200: OK
{
"status": 200
}