POST /api/method/login
内容类型:application/x-www-form-urlencoded
参数(在请求体中):
- usr(字符串)
用户名
- pwd(字符串)
密码
示例:
curl -X POST https://{your frappe instance}/api/method/login \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{"usr":"Administrator","pwd":"admin"}'
返回结果:
- HTTP 状态码:200
- application/json:
{
"home_page": "/desk",
"full_name": "Administrator",
"message": "Logged in"
}
- Cookie:
sid(发送此 Cookie 以验证后续请求)。有效期三天。
sid=05d8d46aaebff1c87a90f570a3ff1c0f570a3ff1c87a90f56bacd4;
path=/;
domain=.{your frappe instance};
Expires=Sat, 29 Sep 2018 00:59:54 GMT;
错误信息:
- HTTP 状态码:401
- text/html:密码或用户名错误。
GET /api/method/logout
示例:
curl -X GET https://{your frappe instance}/api/method/logout
返回结果:
- HTTP 状态码:200
- application/json:
{}
GET /api/method/frappe.auth.get_logged_user
获取当前已认证用户的 ID。
示例:
curl -X GET https://{your frappe instance}/api/method/frappe.auth.get_logged_user
返回结果:
- HTTP 状态码:200
- application/json:
{
"message": "Administrator"
}
作者:Raffael Meyer([email protected])