Login
Description
You may use this API to obtain an token and put it in custom HTTP header field edge-token to authenticate caller’s id in subsequent API callings. The default validity of edge-token is 8 hours; the maximum validity is 31 days.
URI
POST /admin-api/user/login
JSON Body Parameters
{
"username":"username",
"password":"password",
"remember": false, # When remember is true, the edge-token is valid for 31 days.
"plugin":"Builtin"
}
Example Request
Shell
curl https://{admin-site}/admin-api/user/login -X 'POST' -d '{"username":"username","password":"password","plugin":"Builtin"}'
Example Response
Status: 200 OK
{
"status": 0,
"msg": "login successful.",
"data": {
"_created_unix": "2021-07-26 00:44:40.097306",
"username": "edge-admin",
"edge-token": "6332de49089ec6a24567b3efcabb1012139947b0c232a52e85b88cdcb02bd530",
"id": 1,
"_modified_unix": "2021-07-26 00:44:40.097306",
"role": "master",
"login_2fa": {}
},
"time": 1627290462
}
Usage of edge-token
Set edge-token to the HTTP header when calling other APIs, Example:
curl https://{admin-site}/admin-api/user/logout \
-H "edge-token: 2aeac420361ba6c202887452f0ffab8fffc619731cc3daffc6bc7a4707756abf",