Authentication
Public endpoints. Session/administrative writes are not executed in the public Playground.
Endpoint
curl --request POST 'https://api.oneaster.ai/core/v1/auth/login' \ --header 'Content-Type: application/json' \ --data "$REQUEST_BODY_JSON"
Parameters
—
Request JSON Schema
{
"type": "object",
"additionalProperties": false,
"properties": {
"username": {
"type": "string",
"minLength": 3,
"maxLength": 64
},
"password": {
"type": "string",
"maxLength": 128
}
},
"required": [
"username",
"password"
]
}
Responses
200
密码登录;会话一小时
{
"application/json": {
"schema": {
"type": "object",
"additionalProperties": false,
"properties": {
"success": {
"const": true
},
"data": {
"type": "object",
"additionalProperties": false,
"properties": {
"access_token": {
"type": "string"
},
"expires_at": {
"type": "string",
"format": "date-time"
},
"user": {
"type": "object",
"additionalProperties": false,
"properties": {
"id": {
"type": "string",
"pattern": "^[0-9]+$"
},
"username": {
"type": "string"
},
"admin": {
"type": "boolean"
}
},
"required": [
"id",
"username",
"admin"
]
}
},
"required": [
"access_token",
"expires_at",
"user"
]
}
},
"required": [
"success",
"data"
]
}
}
}
default
错误代码见 core-api.md;供应商/数据库错误已隐藏。
{
"application/json": {
"schema": {
"type": "object",
"additionalProperties": false,
"properties": {
"success": {
"const": false
},
"error": {
"type": "object",
"additionalProperties": false,
"properties": {
"code": {
"type": "string"
},
"message": {
"type": "string"
},
"type": {
"const": "oneaster_error"
}
},
"required": [
"code",
"message",
"type"
]
},
"data": {
"type": "null"
}
},
"required": [
"success",
"error",
"data"
]
}
}
}