curl --request POST \
--url 'https://management.scanova.io/multi-users/access-levels/' \
--header 'Authorization: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"name": "Regional Support",
"permissions": [23, 24, 31]
}'
{
"id": 42,
"name": "Regional Support",
"slug": null,
"permissions": [
{ "id": 23, "code": "QR_CODE_CAN_VIEW", "name": "Can view QR Code", "description": "Allows viewing QR code details.", "is_boolean": true },
{ "id": 24, "code": "ANALYTICS_CAN_VIEW", "name": "Can view Analytics", "description": "Allows viewing analytics.", "is_boolean": true },
{ "id": 31, "code": "LEAD_GENERATION_CAN_VIEW", "name": "Can view Lead Lists", "description": "Allows viewing lead lists.", "is_boolean": true }
],
"is_custom": true
}
管理 API — 共享用户与角色
创建自定义角色
POST /multi-users/access-levels/
POST
/
multi-users
/
access-levels
/
curl --request POST \
--url 'https://management.scanova.io/multi-users/access-levels/' \
--header 'Authorization: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"name": "Regional Support",
"permissions": [23, 24, 31]
}'
{
"id": 42,
"name": "Regional Support",
"slug": null,
"permissions": [
{ "id": 23, "code": "QR_CODE_CAN_VIEW", "name": "Can view QR Code", "description": "Allows viewing QR code details.", "is_boolean": true },
{ "id": 24, "code": "ANALYTICS_CAN_VIEW", "name": "Can view Analytics", "description": "Allows viewing analytics.", "is_boolean": true },
{ "id": 31, "code": "LEAD_GENERATION_CAN_VIEW", "name": "Can view Lead Lists", "description": "Allows viewing lead lists.", "is_boolean": true }
],
"is_custom": true
}
每个共享用户都会被分配一个角色——Scanova 仪表盘在内部将其称为”访问级别”(access levels),这个术语在本端点中始终沿用。在通过
POST /multi-users/ 邀请团队成员之前,使用此端点查询可用的角色,或从您自己的系统中创建自定义角色。
此端点此前未被记录过文档。它需要一个拥有
MANAGEMENT_API(或 MANAGEMENT_API_SANDBOX)配额的 Management API 密钥——参见 Management API 概览。关于每个角色实际授予团队成员的权限,请参见面向人类读者的角色与权限指南——本页仅记录数据格式。创建自定义角色需要账户套餐上的专属配额(与隐藏仪表盘 Roles 标签页——针对不支持该功能的套餐——的门槛相同,参见自定义角色受套餐限制)。此处返回 403 说明该套餐不包含此功能。
curl --request POST \
--url 'https://management.scanova.io/multi-users/access-levels/' \
--header 'Authorization: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"name": "Regional Support",
"permissions": [23, 24, 31]
}'
{
"id": 42,
"name": "Regional Support",
"slug": null,
"permissions": [
{ "id": 23, "code": "QR_CODE_CAN_VIEW", "name": "Can view QR Code", "description": "Allows viewing QR code details.", "is_boolean": true },
{ "id": 24, "code": "ANALYTICS_CAN_VIEW", "name": "Can view Analytics", "description": "Allows viewing analytics.", "is_boolean": true },
{ "id": 31, "code": "LEAD_GENERATION_CAN_VIEW", "name": "Can view Lead Lists", "description": "Allows viewing lead lists.", "is_boolean": true }
],
"is_custom": true
}
string
必填
角色名称。在该账户的角色中必须唯一——重复的名称会返回一个 400 错误,内容为
{"name": ["Can not create another user role with the same name."]}。array
必填
要授予的权限 ID,来自上方列表响应中的
permissions[].id 值。Management API 上没有独立于角色之外的”列出所有可用权限”批量端点——要发现权限 ID,请从某个现有角色的
permissions 数组中读取(每个账户至少可以查看 6 个系统角色)。相关内容
- 列出角色 — 同一端点的另一个操作。
- 邀请共享用户 —— 在邀请或更新团队成员时,从此列表中分配一个角色 ID。
- 更新共享用户 —— 在邀请或更新团队成员时,从此列表中分配一个角色 ID。
- 角色与权限 —— 面向人类读者的说明,介绍每个角色授予的权限,包括自定义角色的套餐门槛。
- 共享用户 —— 仪表盘的 Users 表格,这些角色在其中通过界面进行分配。
授权
Send your Management API key as the raw value of the Authorization header — no "Bearer " or "Token " prefix, and no other characters. Example: Authorization: 401f7ac837da42b97f613d789819ff93537bee6a. A header containing more than one space-separated part is rejected outright. Requests also require the request's Host header to be the management API host (e.g. management.scanova.io) — the same key sent to the regular API host will not authenticate.
请求体
application/json
响应
201 - application/json
Custom role created. Requires the account's custom-roles plan quota.
此页面对您有帮助吗?
⌘I