xxxxxxxxxx
Notice: API Token is required to enable in your account settings, the token will be used in the each API request for identify your permission, and you need add an `Authorization: Token XXX` header to your request. `XXX` is the token you generated in your account settings page.
Add / create a new user.
xxxxxxxxxx
POST /api/user/add
Attribute Type Required Description username
string(10) no The username password
string(10) no The password Example
xxxxxxxxxx
$ curl -X POST -H 'Content-Type: application/json' -H 'Authorization: Token fiMY9nMdrE82zSD1IbUuVr6J' --data '{"username": "test", "password": "test"}' http://192.168.2.3:8000/api/user/add
{
"user_id": 1,
"username": "test",
"password": "test",
"package_id": null,
"package_name": null,
"expire_date": "2021-11-05 15:47:05",
"max_connections": 1
}
Add package to user.
xxxxxxxxxx
POST /api/user/<int:user_id>/package/add
Attribute Type Required Description package_id
int yes Package ID for add to the user Example
xxxxxxxxxx
$ curl -X POST -H 'Content-Type: application/json' -H 'Authorization: Token fiMY9nMdrE82zSD1IbUuVr6J' --data '{"package_id": 1}' http://192.168.2.3:8000/api/user/1/package/add
{
"user_id": 1,
"username": "test",
"password": "test",
"package_id": 1,
"package_name": "Package 1",
"expire_date": "2021-12-05 23:59:47",
"max_connections": 1
}
Renew the package.
xxxxxxxxxx
POST /api/user/<int:user_id>/package/renew
Example
xxxxxxxxxx
$ curl -X POST -H 'Content-Type: application/json' -H 'Authorization: Token fiMY9nMdrE82zSD1IbUuVr6J' http://192.168.2.3:8000/api/user/1/package/renew
{
"user_id": 1,
"username": "test",
"password": "test",
"package_id": 1,
"package_name": "Package 1",
"expire_date": "2022-01-04 23:59:47",
"max_connections": 1
}
Change the package.
xxxxxxxxxx
POST /api/user/<int:user_id>/package/change
Attribute Type Required Description package_id
int yes Package ID for add to the user Example
xxxxxxxxxx
$ curl -X POST -H 'Content-Type: application/json' -H 'Authorization: Token fiMY9nMdrE82zSD1IbUuVr6J' --data '{"package_id": "2"}' http://192.168.2.3:8000/api/user/1/package/change
{
"user_id": 1,
"username": "test",
"password": "test",
"package_id": 2,
"package_name": "Package 2",
"expire_date": "2021-11-24 00:02:54",
"max_connections": 5
}
Cancel the package.
xxxxxxxxxx
POST /api/user/<int:user_id>/package/cancel
Example
xxxxxxxxxx
$ curl -X POST -H 'Content-Type: application/json' -H 'Authorization: Token fiMY9nMdrE82zSD1IbUuVr6J' http://192.168.2.3:8000/api/user/1/package/cancel
{
"user_id": 1,
"username": "test",
"password": "test",
"package_id": null,
"package_name": null,
"expire_date": "2021-11-05 16:05:21",
"max_connections": 0
}
Query the user info via username or user_id.
xxxxxxxxxx
GET /api/user/info
Attribute Type Required Description user_id int no The user ID username string no The username Example
xxxxxxxxxx
$ curl -X GET -H 'Content-Type: application/json' -H 'Authorization: Token fiMY9nMdrE82zSD1IbUuVr6J' http://192.168.2.3:8000/api/user/info?username=test
{
"user_id": 1,
"username": "test",
"password": "test",
"package_id": null,
"package_name": null,
"expire_date": "2021-11-05 16:05:21",
"max_connections": 0
}