Skip to content

ryan4664/smart-ac-api-documentation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

Smart AC Public API

A Postman collection containing all of the below endpoints can be found here.

Register Device

Registers a device in the database.

POST /devices/register
{
  "serial_number": string,
  "registration_date": string,
  "firmware_version": string,
  "secret": string,
}

Success (200)

{
  "id" : number,
  "token": string,
}

The token in the response body will be a jwt and required on subsequent requsts to authenticate with the API.

Error (400)

{
  "error" : string,
}

Reauthentice Device

To be used when the token expires (currently expires after 7 days) to authenticate and receieve a new token.

POST /devices/login
headers: {
    'Authorization': 'YOUR_TOKEN'
}
{
  "secret": string,
}

Success (200)

{
  "token": string,
}

Error (401)

Invalid token.

{
  "error" : string,
}

Error (400)

Invalid secret.

{
  "error" : string,
}

Update

Inserts a new device_sensor_data record.

POST /devices/update
headers: {
    'Authorization': 'YOUR_TOKEN'
}
{
  "temp_celsius": string,
  "air_humidity_percentage": string,
  "carbon_monoxide_level": string,
  "status": string,
}

Success (200)

Error (401)

Invalid token.

{
  "error" : string,
}

Update Bulk

Inserts multiple new device_sensor_data records. A maximum of 500 records can be past in.

POST /devices/update
headers: {
    'Authorization': 'YOUR_TOKEN'
}
[
  {
    "temp_celsius": string,
    "air_humidity_percentage": string,
    "carbon_monoxide_level": string,
    "status": string,
  },
  {
    "temp_celsius": string,
    "air_humidity_percentage": string,
    "carbon_monoxide_level": string,
    "status": string,
  },
  ...
]

Success (200)

Error (400)

Occurs when there are too many records or the value passed in is not an array.

{
  "error" : string,
}

Error (401)

Invalid token.

{
  "error" : string,
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published