API List

Devices – Request List of Devices

Request information of all registered devices
GET /devices/list

Permission: User

curl -H "Authorization: Bearer 62e4856d63e371c32e06540f9677850595cd993234d6fe8251890958"      \
     https://api.encoredtech.com/1.2/devices/list

HEADER

Field Type Description
Authorization String Bearer Auth or Basic Auth

Bearer {token}

SUCCESS 200

Field Type Description
devices Array array of devices
  device Object device object
    serialNumber Number device’s serial number (decimal)
    uuid String device’s uuid
    model String device’s model
    createdAt Number registration time (timestamp. ms)
    macAddress String device mac address
HTTP/1.1 200 OK
[
     {
         "serialNumber": 4093440583,
         "macAddress": "84:72:07:19:b0:58",
         "model": "EDM3",
         "createdAt": 1445743409000,
         "uuid": "BB869C70-7AC7-11E5-B8CB-61B2740190CC"
     }
]

400

Field Description
InvalidHeaderError Error is returned in following cases:
– ‘Authorization’ Header is missed
InvalidContentError Error is returned in following cases:
– Required paramters are missed
– Parameter is not valid
– Other errors in Parameter

403

Field Description
NotAuthorizeError Invalid apikey

404

Field Description
ResourceNotFoundError Requested Resource does not exist

500

Field Description
InternalError Other Server Errors
HTTP/1.1 400 Bad Request
{
    "code": "InvalidHeader",
    "message": "Authorization Header is missed"
}

Devices – Request Plug Relay Status

Request information of a device

GET /devices/:deviceId/relay

Permission: User

curl -H "Authorization: Bearer 62e4856d63e371c32e06540f9677850595cd993234d6fe8251890958d77ff0d8daa2eea7a2ce9c760fd7fc16a9b08d088303d50fd72ae0fab63f217ab02f0842"      
https://api.encoredtech.com/1.2/devices/5ADC31B0-320A-11E5-9A2D-0FE805413009/relay

Header

Field Type Description
Authorization String Bearer Auth or Basic Auth

Bearer {token}

URL Param

Field Type Description
deviceId String UUID of a device

Success 200

Field Type Description
status String current status
HTTP/1.1 200 OK
{
"status": "ON"
}

400

Field Description
InvalidHeaderError Error is returned in following cases:
– ‘Authorization’ Header is missed
InvalidContentError Error is returned in following cases:
– Required paramters are missed
– Parameter is not valid
– Other errors in Parameter

403

Field Description
NotAuthorizeError Invalid apikey

404

Field Description
ResourceNotFoundError Requested Resource does not exist

500

Field Description
InternalError Other Server Errors
HTTP/1.1 400 Bad Request
{
"code": "InvalidHeader",
"message": "Authorization Header is missed"
}

Devices – Toggle Plug Relay Status

Toggle the status of Plug relay status

PUT /devices/:deviceId/relay

Permission: User

curl -X PUT -H "Authorization: Bearer 62e4856d63e371c32e06540f9677850595cd993234d6fe8251890958"      
https://api.encoredtech.com/1.2/devices/5ADC31B0-320A-11E5-9A2D-0FE805413009/relay?mode=ON

Header

Field Type Description
Authorization String Bearer Auth or Basic Auth

Bearer {token}

URL Param

Field Type Description
deviceId String UUID of a device

Query String

Field Type Description
status String wanted status

Success 200

Field Type Description
status String current status
HTTP/1.1 200 OK
{
"status": "ON"
}

400

Field Description
InvalidHeaderError Error is returned in following cases:
– ‘Authorization’ Header is missed
InvalidContentError Error is returned in following cases:
– Required paramters are missed
– Parameter is not valid
– Other errors in Parameter

403

Field Description
NotAuthorizeError Invalid apikey

404

Field Description
ResourceNotFoundError Requested Resource does not exist

500

Field Description
InternalError Other Server Errors
HTTP/1.1 400 Bad Request
{
"code": "InvalidHeader",
"message": "Authorization Header is missed"
}

Devices – Request Realtime Usage

Request realtime usage of device

GET /devices/:deviceId/realtimeUsage

Permission: User

curl -G                                                                     
-H "Authorization: Bearer 62e4856d63e371c32e06540f9677850595cd993234d6fe8251890958d77ff0d8daa2eea7a2ce9c760fd7fc16a9b08d088303d50fd72ae0fab63f217ab02f0842" 
https://api.encoredtech.com/1.2/devices/5ADC31B0-320A-11E5-9A2D-0FE805413009/realtimeUsage

Header

Field Type Description
Authorization String Bearer Auth or Basic Auth

Bearer {token}

URL Param

Field Type Description
deviceId String UUID of a device

Success 200

Field Type Description
  timestamp Number timestatmp (ms)
  voltage Number voltage (mV)
  current Number current (mA)
  activePower Number active power (mW)
  apparentPower Number apparent power (mVA)
  reactivePower Number reactive power (mVar)
  powerFactor Number power factor
  wattHour Number accumulated usage (mWh)
  powerBase Number power base (mWh)
HTTP/1.1 200 OK
{
"timestamp": 1390961400000,
"voltage": 100000,
"current": 1000,
"activePower": 100000,
"apparentPower": 100000,
"reactivePower": 100000,
"powerFactor": 1000,
"wattHour": 0,
"powerBase": 100000,
}

400

Field Description
InvalidHeaderError Error is returned in following cases:
– ‘Authorization’ Header is missed
InvalidContentError Error is returned in following cases:
– Required paramters are missed
– Parameter is not valid
– Other errors in Parameter

403

Field Description
NotAuthorizeError Invalid apikey

404

Field Description
ResourceNotFoundError Requested Resource does not exist

500

Field Description
InternalError Other Server Errors
HTTP/1.1 400 Bad Request
{
"code": "InvalidHeader",
"message": "Authorization Header is missed"
}