添加策略
测试中
POST
/api/v2/policies/create
请求参数
Header 参数
Authorization
string
必需
示例值:
Bearer token
x-authing-userpool-id
string
用户池 ID
示例值:
61cc2c7bb686e2767125230d
Body 参数application/json
code
string
必需
statements
array [object {5}]
必需
actions
array[string]
可选
condition
array [object {3}]
可选
effect
string
可选
resource
string
可选
resourceType
string
可选
description
string
可选
namespace
string
可选
示例
{
"code": "string",
"statements": [
{
"actions": [
"string"
],
"condition": [
{
"operator": "string",
"param": "string",
"value": "string"
}
],
"effect": "string",
"resource": "string",
"resourceType": "string"
}
],
"description": "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/policies/create' \
--header 'Authorization: Bearer token' \
--header 'x-authing-userpool-id: 61cc2c7bb686e2767125230d' \
--header 'Content-Type: application/json' \
--data-raw ''
返回响应
🟢200成功
application/json
Body
code
integer
必需
message
string
必需
data
object
必需
userPoolId
string
必需
isDefault
boolean
必需
isAuto
boolean
必需
hidden
boolean
必需
code
string
必需
namespaceId
integer
必需
createdAt
string
必需
updatedAt
string
必需
id
string
必需
description
null
必需
statements
array [object {5}]
必需
assignmentsCount
integer
必需
namespace
string
必需
示例
{
"code": 200,
"message": "创建成功",
"data": {
"userPoolId": "59f86b4832eb28071bdd9214",
"isDefault": false,
"isAuto": false,
"hidden": false,
"code": "test",
"namespaceId": 2,
"createdAt": "2022-01-11T11:26:12.310Z",
"updatedAt": "2022-01-11T11:26:12.310Z",
"id": "61dd6954e0f8f6e147fc9637",
"description": null,
"statements": [
{
"resource": "*:*",
"actions": [
"*"
],
"effect": "ALLOW",
"condition": [
{
"operator": "DateEquals",
"param": "CurrentTime",
"value": "2022-01-18T09:11:21.511Z"
}
],
"resourceType": "DATA"
}
],
"assignmentsCount": 0,
"namespace": "default"
}
}
修改于 2022-01-24 06:16:45