API Contract version V1 - adnan1975/cb-smart-ac GitHub Wiki

This Document is to show the API contract for V1 , the tool https://jsoneditoronline.org/ was used

Note: this document is out dated please check out the Swagger documentation at http://104.248.180.30/v1/api-doc/index.html

Device API Endpoint for adding measurement

Path

api/v1/device/measurement/add

Method

Post

Request Header

userId: mac address for the AC to authenticate the device. 
transactionId : unique identifier for the request.

Request Body

[
  {
    "serialNumber": "string",
    "transactionId": "string",
    "temperature": 100,
    "humidity": 12,
    "ppm": 12,
    "healthStatus": "enum150",
    "deviceId" : "1"
  },
  {
    "serialNumber": "string",
    "transactionId": "string",
    "temperature": 100,
    "humidity": 12,
    "ppm": 12,
    "healthStatus": "enum150",
"deviceId" : "1"
  }
]

Device API Endpoint for searching device

Path

api/v1/devices

Query Params

serialNumber
macAddress
registrationNumber

Method

Get

Request Header

userId: logged in user. 
transactionId : unique identifier for the request.

Response Body

[
  {
    "serialNumber": "string",
    "transactionId": "string",
    "temperature": 100,
    "humidity": 12,
    "ppm": 12,
    "healthStatus": "enum150"
  },
  {
    "serialNumber": "string",
    "transactionId": "string",
    "temperature": 100,
    "humidity": 12,
    "ppm": 12,
    "healthStatus": "enum150"
  }
]

Device API Endpoint for listing device

Path

api/v1/device/list

Method

Get

Request Header

userId: logged in user. 
transactionId : unique identifier for the request.

Response Body

[
  {
    "serialNumber": "string",
    "transactionId": "string",
    "temperature": 100,
    "humidity": 12,
    "ppm": 12,
    "healthStatus": "enum150"
  },
  {
    "serialNumber": "string",
    "transactionId": "string",
    "temperature": 100,
    "humidity": 12,
    "ppm": 12,
    "healthStatus": "enum150"
  }
]

User API (List all admins)

Path

api/v1/user/list

Method

Get

Request Header

userId: userid for the user requesting. 
transactionId : unique identifier for the request.

Response Body

[
  {
    "userId": "string",
    "createdOn":"string",
    "status" :"string"
  },
  {
    "userId": "string",
    "createdOn":"string",
    "status" :"string"
  }
  
]

User API (authentication endpoints)

Work in Progress

Path

api/v1/user/login api/v1/user/logout api/v1/user/reset

Method

Get or Post

Request Header

userId: userid for the user requesting. 
transactionId : unique identifier for the request.
⚠️ **GitHub.com Fallback** ⚠️