创建角色
POST
/api/v2/roles
请求参数
Header 参数
Authorization
string
Token
示例值:
Bearer token
x-authing-userpool-id
string
用户池 ID
示例值:
61b95d6c96d42670da568408
Body 参数application/json
code
string
角色唯一标识,必传
description
string
描述
parent
string
可选
namespace
string
可选
示例
{
"code": "string",
"description": "string",
"parent": "string",
"namespace": "string"
}
示例代码
Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://core.authing.cn/api/v2/roles' \
--header 'Authorization: Bearer token' \
--header 'x-authing-userpool-id: 61b95d6c96d42670da568408' \
--header 'Content-Type: application/json' \
--data-raw ''
返回响应
🟢200成功
application/json
Body
code
integer
必需
message
string
必需
data
object
必需
userPoolId
string
必需
code
string
必需
description
string
必需
parentCode
string
必需
isSystem
boolean
必需
namespaceId
integer
必需
createdAt
string
必需
updatedAt
string
必需
id
string
必需
示例
{
"code": 200,
"message": "创建成功",
"data": {
"userPoolId": "61b95d6c96d42670da568408",
"code": "apifoxRole2",
"description": "用 Apifox 创建的角色",
"parentCode": "61dbe4836beb0afb44d14b88",
"isSystem": false,
"namespaceId": 5,
"createdAt": "2022-01-12T11:12:18.909Z",
"updatedAt": "2022-01-12T11:12:18.909Z",
"id": "61deb79210cbe1664f4bfe57"
}
}
修改于 2022-01-14 09:42:52