角色端點
角色定義管理員、專家或一般使用者對貴組織資源的存取權。 在基於角色的存取控制環境中,使用者存取布建是透過共同責任和需求進行分組。 一個角色具有一組給定的權限,您的組織成員可以指派到一個或多個角色,依據他們需要的視圖範圍或寫入權限而定。
此 /roles
以屬性為基礎的存取控制API中的端點可讓您以程式設計方式管理組織中的角色。
快速入門
本指南中使用的API端點屬於屬性型存取控制API的一部分。 在繼續之前,請檢閱 快速入門手冊 如需相關檔案的連結,請參閱本檔案範例API呼叫的指南,以及有關成功呼叫任何Experience PlatformAPI所需標題的重要資訊。
擷取角色清單 list
您可以透過向以下人員發出GET請求,列出屬於您組織的所有現有角色: /roles
端點。
API格式
GET /roles/
要求
下列請求會擷取屬於您組織的角色清單。
curl -X GET \
https://platform.adobe.io/data/foundation/access-control/administration/roles \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {IMS_ORG}' \
回應
成功的回應會傳回組織中的角色清單,包括有關其各自角色型別、許可權集和主體屬性的資訊。
{
"roles": [
{
"id": "3dfa045d-de58-4dfd-8ea9-e4e2c1b6d809",
"name": "Administrator Role",
"description": "Role for administrator type of responsibilities and access",
"roleType": "user-defined",
"permissionSets": [
"manage-datasets",
"manage-schemas"
],
"sandboxes": [
"prod"
],
"subjectAttributes": {
"labels": [
"core/S1"
]
},
"createdBy": "{CREATED_BY}",
"createdAt": 1648153201825,
"modifiedBy": "{MODIFIED_BY}",
"modifiedAt": 1648153201825,
"etag": null
}
],
"_page": {
"limit": 1,
"count": 1
},
"_links": {
"next": {
"href": "https://platform.adobe.io:443/data/foundation/access-control/administration/roles/3dfa045d-de58-4dfd-8ea9-e4e2c1b6d809",
"templated": true
},
"page": {
"href": "https://platform.adobe.io:443/data/foundation/access-control/administration/roles/3dfa045d-de58-4dfd-8ea9-e4e2c1b6d809",
"templated": true
},
"subjects": {
"href": "https://platform.adobe.io:443/data/foundation/access-control/administration/roles/3dfa045d-de58-4dfd-8ea9-e4e2c1b6d809",
"templated": true
}
}
}
id
name
description
roleType
user-defined
和 system-defined
.permissionSets
sandboxes
subjectAttributes
subjectAttributes.labels
查詢角色 lookup
您可以透過提出包含對應角色的GET請求來查詢個別角色 roleId
在請求路徑中。
API格式
GET /roles/{ROLE_ID}
要求
以下請求會擷取以下專案的資訊: {ROLE_ID}
.
curl -X GET \
https://platform.adobe.io/data/foundation/access-control/administration/roles/3dfa045d-de58-4dfd-8ea9-e4e2c1b6d809 \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {IMS_ORG}' \
回應
成功的回應會傳回查詢角色ID的詳細資料,包括其角色型別、許可權集和主體屬性的資訊。
{
"id": "3dfa045d-de58-4dfd-8ea9-e4e2c1b6d809",
"name": "Administrator Role",
"description": "Role for administrator type of responsibilities and access",
"roleType": "user-defined",
"permissionSets": [
"manage-datasets",
"manage-schemas"
],
"sandboxes": [
"prod"
],
"subjectAttributes": {
"labels": [
"core/S1"
]
},
"createdBy": "{CREATED_BY}",
"createdAt": 1648153201825,
"modifiedBy": "{MODIFIED_BY}",
"modifiedAt": 1648153201825,
"etag": null
}
id
name
description
roleType
user-defined
和 system-defined
.permissionSets
sandboxes
subjectAttributes
subjectAttributes.labels
依角色ID查詢主題
您也可以向以下網站發出GET要求來擷取主題: /roles
端點並提供 {ROLE_ID}.
API格式
GET /roles/{ROLE_ID}/subjects
要求
以下請求會擷取與關聯的主體 3dfa045d-de58-4dfd-8ea9-e4e2c1b6d809
.
curl -X GET \
https://platform.adobe.io/data/foundation/access-control/administration/roles/3dfa045d-de58-4dfd-8ea9-e4e2c1b6d809/subjects \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {IMS_ORG}' \
回應
成功回應會傳回與查詢的角色ID相關聯的主題,包括對應的主題ID和主題型別。
{
"items": [
{
"roleId": "3dfa045d-de58-4dfd-8ea9-e4e2c1b6d809",
"subjectType": "user",
"subjectId": "03Z07HFQCCUF3TUHAX274206@AdobeID"
},
{
"roleId": "3dfa045d-de58-4dfd-8ea9-e4e2c1b6d809",
"subjectType": "user",
"subjectId": "PIRJ7WE5T3QT9Z4TCLVH86DE@AdobeID"
},
{
"roleId": "3dfa045d-de58-4dfd-8ea9-e4e2c1b6d809",
"subjectType": "user",
"subjectId": "WHPWE00MC26SHZ7AKBFG403D@AdobeID"
},
]
"_page": {
"limit": 0,
"count": 0
},
"_links": {
"self": {
"href": "/roles/{ROLE_ID}/subjects",
"templated": false,
"type": null,
"method": null
},
"page": {
"href": "/roles/{ROLE_ID}/subjects?limit={limit}&start={start}&orderBy={orderBy}&property={property}",
"templated": true,
"type": null,
"method": null
}
}
}
roleId
subjectType
subjectId
建立角色 create
POST若要建立新角色,請向 /roles
端點,同時提供角色名稱、說明和角色型別的值。
API格式
POST /roles/
要求
curl -X POST \
https://platform.adobe.io/data/foundation/access-control/administration/roles \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {IMS_ORG}'
-d'{
"name": "Administrator Role",
"description": "Role for administrator type of responsibilities and access",
"roleType": "user-defined"
}'
name
description
roleType
user-defined
和 system-defined
.回應
成功的回應會傳回您新建立的角色,以及其對應的角色ID,以及其角色型別、許可權集和主體屬性的資訊。
{
"id": "3dfa045d-de58-4dfd-8ea9-e4e2c1b6d809",
"name": "Administrator Role",
"description": "Role for administrator type of responsibilities and access",
"roleType": "user-defined",
"permissionSets": [
"manage-datasets",
"manage-schemas"
],
"sandboxes": [
"prod"
],
"subjectAttributes": {
"labels": [
"core/S1"
]
},
"createdBy": "{CREATED_BY}",
"createdAt": 1648153201825,
"modifiedBy": "{MODIFIED_BY}",
"modifiedAt": 1648153201825,
"etag": null
}
id
name
description
roleType
user-defined
和 system-defined
.permissionSets
sandboxes
subjectAttributes
subjectAttributes.labels
更新角色 patch
您可以透過向以下專案發出PATCH請求來更新角色的屬性: /roles
端點,並為您要套用的作業提供對應的角色ID和值。
API格式
PATCH /roles/{ROLE_ID}
要求
curl -X PATCH \
https://platform.adobe.io/data/foundation/access-control/administration/roles/{ROLE_ID} \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {IMS_ORG}'
-d'{
"operations": [
{
"op": "add",
"path": "/description",
"value": "Role with permission sets for admin type of access"
}
]
}'
op
add
, replace
、和 remove
.path
value
回應
成功的回應會傳回更新的角色,包括您選擇更新的屬性的新值。
{
"id": "3dfa045d-de58-4dfd-8ea9-e4e2c1b6d809",
"name": "Administrator Role",
"description": "Role with permission sets for admin type of access",
"roleType": "user-defined",
"permissionSets": [
"manage-datasets",
"manage-schemas"
],
"sandboxes": [
"prod"
],
"subjectAttributes": {
"labels": [
"core/S1"
]
},
"createdBy": "{CREATED_BY}",
"createdAt": 1648153201825,
"modifiedBy": "{MODIFIED_BY}",
"modifiedAt": 1648153201825,
"etag": null
}
id
name
description
roleType
user-defined
和 system-defined
.permissionSets
sandboxes
subjectAttributes
subjectAttributes.labels
依角色ID更新角色 put
您可以透過向以下專案發出PUT請求來更新角色: /roles
端點,並指定與您要更新的角色對應的角色ID。
API格式
PUT /roles/{ROLE_ID}
要求
以下請求會更新角色ID的名稱、說明和角色型別: 3dfa045d-de58-4dfd-8ea9-e4e2c1b6d809
.
curl -X PUT \
https://platform.adobe.io/data/foundation/access-control/administration/roles/3dfa045d-de58-4dfd-8ea9-e4e2c1b6d809 \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {IMS_ORG}'
-d'{
"name": "Administrator role for ACME",
"description": "New administrator role for ACME",
"roleType": "user-defined"
}'
name
description
roleType
user-defined
和 system-defined
.回應
成功的回應會傳回您更新的角色,包括其名稱、說明和角色型別的新值。
{
"id": "3dfa045d-de58-4dfd-8ea9-e4e2c1b6d809",
"name": "Administrator role for ACME",
"description": "New administrator role for ACME",
"roleType": "user-defined",
"permissionSets": [
"manage-datasets",
"manage-schemas"
],
"sandboxes": [
"prod"
],
"subjectAttributes": {
"labels": [
"core/S1"
]
},
"createdBy": "{CREATED_BY}",
"createdAt": 1648153201825,
"modifiedBy": "{MODIFIED_BY}",
"modifiedAt": 1648153201825,
"etag": null
}
id
name
description
roleType
user-defined
和 system-defined
.permissionSets
sandboxes
subjectAttributes
subjectAttributes.labels
依角色ID更新主旨
PATCH若要更新與角色相關聯的主體,請向 /roles
端點,同時提供您要更新之主體的角色ID。
API格式
PATCH /roles/{ROLE_ID}/subjects
要求
以下要求會更新與關聯的主題 {ROLE_ID}
.
curl --location --request PATCH 'https://platform.adobe.io/data/foundation/access-control/administration/roles/<ROLE_ID>/subjects' \
--header 'Authorization: Bearer {ACCESS_TOKEN}' \
--header 'x-api-key: {API_KEY}' \
--header 'x-gw-ims-org-id: {IMS_ORG}' \
--header 'Content-Type: application/json' \
--data-raw '[
{
"op": "add",
"path": "/user",
"value": "{USER ID}"
}
]'
op
add
, replace
、和 remove
.path
value
回應
成功的回應會傳回您更新的角色,包括主題的新值。
{
"subjects": [
[
{
"subjectId": "03Z07HFQCCUF3TUHAX274206@AdobeID",
"subjectType": "user"
}
]
],
"_page": {
"limit": 1,
"count": 1
},
"_links": {
"self": {
"href": "https://platform.adobe.io:443/data/foundation/access-control/administration/roles/{ROLE_ID}/subjects",
"templated": true
},
"page": {
"href": "https://platform.adobe.io:443/data/foundation/access-control/administration/roles/{ROLE_ID}/subjects?limit={limit}&start={start}&orderBy={orderBy}&property={property}",
"templated": true
}
}
}
刪除角色 delete
DELETE若要刪除角色,請向 /roles
端點,並指定您要刪除的角色的ID。
API格式
DELETE /roles/{ROLE_ID}
要求
以下請求會刪除ID為的角色 {ROLE_ID}
.
curl -X DELETE \
https://platform.adobe.io/data/foundation/access-control/administration/roles/{ROLE_ID} \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {IMS_ORG}' \
回應
成功的回應會傳回HTTP狀態204 (無內容)和空白內文。
您可以嘗試向角色查詢(GET)請求以確認刪除。 您會收到HTTP狀態404 (找不到),因為角色已從管理中移除。
新增API認證 apicredential
若要新增API認證,請發出PATCH請求至 /roles
端點並提供主體的角色ID。
API格式
curl --location --request PATCH 'https://platform.adobe.io/data/foundation/access-control/administration/roles/<ROLE_ID>/subjects' \
--header 'Authorization: Bearer {ACCESS_TOKEN}' \
--header 'x-api-key: {API_KEY}' \
--header 'x-gw-ims-org-id: {IMS_ORG}' \
--header 'Content-Type: application/json' \
--data-raw '[
{
"op": "add",
"path": "/api-integration",
"value": "{TECHNICAL ACCOUNT ID}"
}
]'
op
add
, replace
、和 remove
.path
value
回應
成功的回應會傳回HTTP狀態204 (無內容)和空白內文。