+
Skip to content

QimaoYang/WatchDOG-1

Repository files navigation

WatchDOG

API Design

backend_inner

1.encrypt code method: post URL: {host}:{port}/powercubicle/v1/seat/encrypt

request body(JSON):
{
    "seat_number":string
}
response:
status code: 201
response body{JSON}:
{
    "encrypt_text": string,
    "ipAddr": string,
    "msg": string,
}

backend_outer

1.check all seats status method: get URL: {host}:{port}/powercubicle/v1/seat

response:
status code: 200
response body(JSON):
{
    "data": {
        "seats":
            [
                {"A" : 10},
                {"B": 19},
                ...
            ]  
    }
}

2.check single region seats status method: get URL: {host}:{port}/powercubicle/v1/seat?region={region_code}

response:
status code: 200
response body(JSON):
{
    "data": {
        "seats":{
             "A1" : "availble",
             "A2": "Zhang3",
            ...
        }
    }
}

3.user register method: post URL: {host}:{port}/powercubicle/v1/user/register

request body(JSON):
{
    "name":string,
    "password":string
}
response:
status code: 201
response body{JSON}:
{
    "Session_key":string
}

4.user login method: post URL: {host}:{port}/powercubicle/v1/user/login

request body(JSON):
{
    "name":string,
    "password":string
}
response:
status code: 201
response body{JSON}:
{
    "Session_key":string,
}

5.seat register method: post URL: {host}:{port}/powercubicle/v1/seat/register

request body(JSON):
header:{Auth:{$session_token}}
{
    "encrypted_qrcode":string,
}
response:
status code: 201

5-1.seat release method: post URL: {host}:{port}/powercubicle/v1/seat/release

header:{Auth:{$session_token}}
response:
status code: 201

6.get current seat method: get URL: {host}:{port}/powercubicle/v1/user/seat

header:{"session_key":string}
response:
status code: 200
response body{JSON}:
{
    "seat": "A1"/nil
}

database middleware

1.check all seats status method: get URL: {host}:{port}/powercubicle/v1/db/seat

response:
status code: 200
response body(JSON):
{
    "data": {
        "seats":
            [
                {"A" : 10},
                {"B": 19},
                ...
            ]  
    }
}

2.check single region seats status method: get URL: {host}:{port}/powercubicle/v1/db/seat?region={region_code}

response:
status code: 200
response body(JSON):
{
    "data": {
        "seats":[
            {"A1" : "availble"},
            {"A2": "Zhang3"},
            ...
        ]
    }
}

3.user register method: post URL: {host}:{port}/powercubicle/v1/db/user/register

request body(JSON):
{
    "user_name":string,
    "user_password":string
}
response:
status code: 201
response body{JSON}:
{
    "session_key":string
}

4.user login method: post URL: {host}:{port}/powercubicle/v1/db/user/login

request body(JSON):
{
    "user_name":string,
    "user_password":string
}
response:
status code: 201
response body{JSON}:
{
    "session_key":string,
}

5.seat register method: post URL: {host}:{port}/powercubicle/v1/db/seat/register

header:{Auth:{$session_token}}
request body(JSON):
{
    "encrypted_qrcode":string,
    "time_for_use":enum[-0.5, +0.5, 1]
}
response:
status code: 201

5-1.seat release method: post URL: {host}:{port}/powercubicle/v1/seat/release

header:{Auth:{$session_token}}
response:
status code: 201

6.get current seat method: get URL: {host}:{port}/powercubicle/v1/db/user/seat

header:{"session_key":string}
response:
status code: 200
response body{JSON}:
{
    "seat": "A1"/nil
}

Managemnt Account

1.update key method: post URL: {host}:{port}/powercubicle/v1/management/key

request body(JSON):
{
    "key":string,
}
response:
status code: 200
response body{JSON}:
{
    "status": "success",
}

error_handling

status code: 400
response body{JSON}:
{
    "status": "Bad request",
    "message": "{error_message}"
}
status code: 404
response body{JSON}:
{
    "status": "Request not found",
    "message": "{error_message}"
}
status code: 500
response body{JSON}:
{
    "status": "Internal server error",
    "message": "{error_message}"
}

About

This is an adorable watchdog~

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载