Skip to content
This repository has been archived by the owner on Sep 28, 2021. It is now read-only.

Interface API Documents For V2

喂你脚下有坑 edited this page May 27, 2019 · 1 revision

1. Login

URL : http://SERVER_ADDR/interface/login

Request Parameters :

Name Type Explanation
user String User Account (Authentication)
password String User Password (Authentication)

Return Parameters : JSON of User Info.

2. User

URL : http://SERVER_ADDR/interface/user

2.1. Query User List

Request Parameters :

Name Type Explanation
option Integer 0
uid Integer User ID (Authentication)
token String User Token (Authentication)

Request Permission : admin

2.2. Add User

Request Parameters :

Name Type Explanation
option Integer 1
uid Integer User ID (Authentication)
token String User Token (Authentication)
name String Nickname
user String Account
password String Encoded Password
role Integer Role ID

Request Permission : admin

2.3. Delete User

Request Parameters :

Name Type Explanation
option Integer 2
uid Integer User ID (Authentication)
token String User Token (Authentication)
id Integer Deleted User's ID

Request Permission : admin

2.4. Modify User

Request Parameters :

Name Type Explanation
option Integer 3
uid Integer User ID (Authentication)
token String User Token (Authentication)
id Integer Modified User's ID
name String Nickname
permission String JSON String of Permission
role Integer Role ID

Request Permission : admin

3. Raspi

URL : http://SERVER_ADDR/interface/raspi

3.1. Query Raspi List

Request Parameters :

Name Type Explanation
option Integer 0
uid Integer User ID (Authentication)
token String User Token (Authentication)

Request Permission : build

3.2. Delete Raspi

Request Parameters :

Name Type Explanation
option Integer 2
uid Integer User ID (Authentication)
token String User Token (Authentication)
id Integer Deleted Raspi's ID

Request Permission : build

4. Hardware

URL : http://SERVER_ADDR/interface/hardware

4.1. Query Hardware List In a Room

Request Parameters :

Name Type Explanation
option Integer 0
uid Integer User ID (Authentication)
token String User Token (Authentication)
room Integer Room ID

Request Permission : ``

4.2. Add Hardware

Request Parameters :

Name Type Explanation
option Integer 1
uid Integer User ID (Authentication)
token String User Token (Authentication)
name String Nickname
type Integer Hardware Type ID
host Integer Attached Raspi ID
gpio String GPIO Value
room Integer Room ID

Request Permission : build

4.3. Delete Hardware

Request Parameters :

Name Type Explanation
option Integer 2
uid Integer User ID (Authentication)
token String User Token (Authentication)
id Integer Deleted Hardware's ID

Request Permission : build

5. Room

URL : http://SERVER_ADDR/interface/room

5.1. Query Room List In a Building

Request Parameters :

Name Type Explanation
option Integer 0
uid Integer User ID (Authentication)
token String User Token (Authentication)
building Integer Building ID

Request Permission : ``

5.2. Add Room

Request Parameters :

Name Type Explanation
option Integer 1
uid Integer User ID (Authentication)
token String User Token (Authentication)
name String Nickname
building Integer Building ID

Request Permission : build

5.3. Delete Room

Request Parameters :

Name Type Explanation
option Integer 2
uid Integer User ID (Authentication)
token String User Token (Authentication)
id Integer Deleted Room's ID

Request Permission : build

5.4. Modify Room

Request Parameters :

Name Type Explanation
option Integer 3
uid Integer User ID (Authentication)
token String User Token (Authentication)
id Integer Modified Room's ID
name String Nickname
timeout String Timeout Time in the Room
defaultValue Integer Default State of Light in the Room 0/1

Request Permission : build

6. Building

URL : http://SERVER_ADDR/interface/building

6.1. Query Building List

Request Parameters :

Name Type Explanation
option Integer 0
uid Integer User ID (Authentication)
token String User Token (Authentication)

Request Permission : ``

6.2. Add Building

Request Parameters :

Name Type Explanation
option Integer 1
uid Integer User ID (Authentication)
token String User Token (Authentication)
name String Nickname

Request Permission : build

6.3. Delete Building

Request Parameters :

Name Type Explanation
option Integer 2
uid Integer User ID (Authentication)
token String User Token (Authentication)
id Integer Deleted Building's ID

Request Permission : build

7. Role

URL : http://SERVER_ADDR/interface/role

7.1. Query Role List

Request Parameters :

Name Type Explanation
option Integer 0

Request Permission : ``

7.2. Modify Role

Request Parameters :

Name Type Explanation
option Integer 3
uid Integer User ID (Authentication)
token String User Token (Authentication)
id Integer Modified Role's ID
priority Integer Priority of Role

Request Permission : admin

8. Log

URL : http://SERVER_ADDR/interface/log

8.1. Query Log List

Request Parameters :

Name Type Explanation
option Integer 0

Request Permission : ``

8.2. Solve Emergency Log (And Emergency Status of That Building)

Request Parameters :

Name Type Explanation
option Integer 2
uid Integer User ID (Authentication)
token String User Token (Authentication)
id Integer Solved Log's ID

Request Permission : admin