Headers: Content-Type: application/json
Allowed Methods: POST/GET/PUT/DELETE
Development URL(Example) : http://localhost/api/v3
While Some API may required an access token, it depend on each API defined. For the details about get access token, please see 1.1 Log in.
Access token can send by those ways:
-
Authorization header (recommend) :
Authorization: Bearer {access_token}
Due to
Bearer
is default access token type, soBearer
could be omit.Authorization: {access_token}
-
Form-Encoded Body Parameter (Unavailable)
POST /resource HTTP/1.1 Host: server.example.com Content-Type: application/x-www-form-urlencoded access_token=mF_9.B5f-4.1JqM
-
URI Query Parameter (Unavailable)
GET /resource?access_token={access_token}
GET {baseUrl}/resource
resource list.
POST{baseUrl}/resource
create a new resource.
GET {baseUrl}/resource/:id
get resource details by id.
PUT {baseUrl}/resource/:id
update resource by id.
DELETE {baseUrl}/resource/:id
delete resource by id.
id
The id of the resource item.
status
Select the status of the resource item, -1
for deleted, 0
for disable, 1
for normal.
create_time
update_time
Select the create time or update time of the resource item.
page
The page number , start with 1.
pageSize
Defined the response item count per page, default is 10.
- Via URL query string:
{url}?status=1&create_time=1591314227
- Via request body:
{
"status": 1,
"create_time": 1591314227
}
POST {baseUrl}/oauth/register
{
username: "",
password: "",
mobile: "",
email: "",
gid: 4,
regcode: ''
}
Params | Type | Required | Default | Option |
---|---|---|---|---|
username | string | No | pcclient, iosclient, ... | |
password | string | Yes | 密码 | |
mobile | string | Yes | 手机号 | |
string | Yes | User name | ||
gid | Int | Yes | Password | |
regcode | string | No | 注册识别码 |
Tent API system authorize access permission base Oauth 2.0 , it enables clients to access protected resources by obtaining an access token.
To request an access token, the client obtains authorization from the resource owner. The authorization is expressed in the form of an authorization grant, which the client uses to request the access token. OAuth defines four grant types: authorization code, implicit, resource owner password credentials, and client credentials. It also provides an extension mechanism for defining additional grant types.
This grant type for login.
GET {baseUrl}/oauth/token?client_id={client_id}&grant_type=password&scope=read&username=15913142273&password=111111
POST {baseUrl}/oauth/token
{
"client_id": "{client_id}",
"grant_type": "password",
"scope": "{read}",
"username": "{username}",
"password": "{password}"
}
Params | Type | Required | Default | Option |
---|---|---|---|---|
client_id | string | No | None | pcclient, iosclient, ... |
grant_type | string | Yes | MUST be password in Password Credentials Grant |
|
scope | string | No | read | |
username | string | Yes | username|mobile|email must has one. | |
password | string | Yes | Password |
{
"access_token": "1db3191206e94872cdccf5fc0468109dd073058a",
"token_type": "Bearer",
"expires_in": 864000,
"refresh_token": ""
}
Revoke an access token.
GET or POST {baseUrl}/oauth/logout
{
"status": "OK"
}
GET {baseUrl}/admin/config
{
"totalCount": 1,
"pageSize": 10,
"page": 1,
"totalPage": 1,
"list": [
{
"id": 1,
"name": "side_menu",
"value": null,
"status": 1,
"create_time": 1541873467,
"update_time": null
}
]
}
POST {baseUrl}/admin/config/{config_name}
GET {baseUrl}/admin/config/{config_name}
{
"id": 1,
"name": "side_menu",
"value": "123",
"status": 1,
"create_time": 1541873467,
"update_time": null
}
PUT {baseUrl}/admin/config/{config_name}
{"config_name": "value"} // @param mixed value - support int, string, array, object.
{
"result": "OK",
"updateCount": 1
}
{
"incId": 4,
"menuTree": [
{
"id": 1,
"label": "ADMIN MANAGE",
"type": "header",
"children": [
{
"id": 2,
"label": "User & Auth",
"type": "treeview",
"show": true,
"children": [
{
"id": 3,
"label": "User",
"type": "link",
"show": true,
"path": "fsdg5d1/fdg4vf"
}
]
}
]
}
]
}
Authorize required, user identified by access token.
GET {baseUrl}/admin/sidemenu
[
{
"id": 1,
"label": "ADMIN MANAGE",
"type": "header",
"children": [
{
"id": 2,
"label": "User & Auth",
"type": "treeview",
"show": true,
"children": [
{
"id": 3,
"label": "User",
"type": "link",
"show": true,
"path": "\/fsdg5d1\/fdg4vf",
"icon": "user"
}
],
"icon": "user-circle"
}
]
}
]
GET {baseUrl}/admin/group
{
"totalCount": 1,
"pageSize": 10,
"page": 1,
"totalPage": 1,
"list": [
{
"id": 1,
"name": "Admin",
"auth_menu": null,
"auth_menu_json": null,
"status": 1,
"create_time": 1542165013,
"update_time": null
}
]
}
POST {baseUrl}/admin/group/
{
"name": "string",
"auth_menu": "stringify_json(optional)",
"auth_menu_json": "stringify_json(optional)"
}
{
"result": "OK",
"id": "groupid(int)"
}
PUT {baseUrl}/admin/group/{groupid}
{
"name": "string",
"auth_menu": "stringify_json",
"auth_menu_json": "stringify_json"
}
{
"result": "OK",
"id": "groupid(int)"
}
Authorize required, user identified by access token.
GET {baseUrl}/admin/profile
{
"id": 1,
"uid": null,
"username": "admin",
"nickname": null,
"password": "admin",
"group": "1",
"last_login_ip": null,
"last_login_time": null,
"status": 1,
"create_time": 1542164889,
"update_time": null,
"access_token": "6179f870c857f649559b732f90d045e4014fe2f0"
}