沙箱管理端點
Adobe Experience Platform中的沙箱提供獨立的開發環境,可讓您測試功能、執行實驗及進行自訂設定,而不會影響您的生產環境。 Sandbox API中的/sandboxes
端點可讓您以程式設計方式管理Platform中的沙箱。
快速入門
本指南中使用的API端點是Sandbox API的一部分。 繼續之前,請先檢閱快速入門手冊,以取得相關檔案的連結、閱讀本檔案中範例API呼叫的手冊,以及有關成功呼叫任何Experience PlatformAPI所需必要標題的重要資訊。
擷取沙箱清單 list
您可以透過向/sandboxes
端點發出GET要求,列出屬於您組織的所有沙箱(作用中或其他方式)。
API格式
GET /sandboxes?{QUERY_PARAMS}
{QUERY_PARAMS}
要求
curl -X GET \
https://platform.adobe.io/data/foundation/sandbox-management/sandboxes?&limit=4&offset=1 \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {ORG_ID}' \
回應
成功的回應會傳回屬於您組織的沙箱清單,包括name
、title
、state
和type
等詳細資訊。
{
"sandboxes": [
{
"name": "prod",
"title": "Production",
"state": "active",
"type": "production",
"region": "VA7",
"isDefault": true,
"eTag": 2,
"createdDate": "2019-09-04 04:57:24",
"lastModifiedDate": "2019-09-04 04:57:24",
"createdBy": "{USER_ID}",
"modifiedBy": "{USER_ID}"
},
{
"name": "dev",
"title": "Development",
"state": "active",
"type": "development",
"region": "VA7",
"isDefault": false,
"eTag": 1,
"createdDate": "2019-09-03 22:27:48",
"lastModifiedDate": "2019-09-03 22:27:48",
"createdBy": "{USER_ID}",
"modifiedBy": "{USER_ID}"
},
{
"name": "stage",
"title": "Staging",
"state": "active",
"type": "development",
"region": "VA7",
"isDefault": false,
"eTag": 1,
"createdDate": "2019-09-03 22:27:48",
"lastModifiedDate": "2019-09-03 22:27:48",
"createdBy": "{USER_ID}",
"modifiedBy": "{USER_ID}"
},
{
"name": "dev-2",
"title": "Development 2",
"state": "creating",
"type": "development",
"region": "VA7",
"isDefault": false,
"eTag": 1,
"createdDate": "2019-09-07 10:16:02",
"lastModifiedDate": "2019-09-07 10:16:02",
"createdBy": "{USER_ID}",
"modifiedBy": "{USER_ID}"
}
],
"_page": {
"limit": 4,
"count": 4
},
"_links": {
"next": {
"href": "https://platform.adobe.io:443/data/foundation/sandbox-management/sandboxes/?limit={limit}&offset={offset}",
"templated": true
},
"prev": {
"href": "https://platform.adobe.io:443/data/foundation/sandbox-management/sandboxes?offset=0&limit=1",
"templated": null
},
"page": {
"href": "https://platform.adobe.io:443/data/foundation/sandbox-management/sandboxes?offset=1&limit=1",
"templated": null
}
}
}
name
title
state
沙箱的目前處理狀態。 沙箱的狀態可以是下列任一專案:
creating
:沙箱已建立,但系統仍在布建中。active
:沙箱已建立且作用中。failed
:由於發生錯誤,沙箱無法由系統布建,因此已停用。deleted
:沙箱已手動停用。
type
development
和production
。isDefault
eTag
查詢沙箱 lookup
您可以透過在請求路徑中包含沙箱的name
屬性的GET請求來查詢個別沙箱。
API格式
GET /sandboxes/{SANDBOX_NAME}
{SANDBOX_NAME}
name
屬性。要求
以下請求會擷取名為「dev-2」的沙箱。
curl -X GET \
https://platform.adobe.io/data/foundation/sandbox-management/sandboxes/dev-2 \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {ORG_ID}' \
回應
成功的回應傳回沙箱的詳細資料,包括其name
、title
、state
和type
。
{
"name": "dev-2",
"title": "Development 2",
"state": "creating",
"type": "development",
"region": "VA7",
"isDefault": false,
"eTag": 1,
"createdDate": "2019-09-07 10:16:02",
"lastModifiedDate": "2019-09-07 10:16:02",
"createdBy": "{USER_ID}",
"modifiedBy": "{USER_ID}"
}
name
title
state
沙箱的目前處理狀態。 沙箱的狀態可以是下列任一專案:
- 正在建立:沙箱已建立,但系統仍在布建中。
- 使用中:沙箱已建立且使用中。
- 失敗:由於發生錯誤,沙箱無法由系統布建,因此已停用。
- 已刪除:沙箱已手動停用。
type
development
和production
。isDefault
eTag
建立沙箱 create
您可以對/sandboxes
端點發出POST要求,以建立新的開發或生產沙箱。
建立開發沙箱
若要建立開發沙箱,您必須在要求裝載中提供值為development
的type
屬性。
API格式
POST /sandboxes
要求
以下請求會建立名為「acme-dev」的新開發沙箱。
curl -X POST \
https://platform.adobe.io/data/foundation/sandbox-management/sandboxes \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {ORG_ID}' \
-H 'Content-Type: application/json' \
-d '{
"name": "acme-dev",
"title": "Acme Business Group dev",
"type": "development"
}'
name
title
type
development
。回應
成功的回應會傳回新建立的沙箱的詳細資料,顯示其state
正在「建立」。
{
"name": "acme-dev",
"title": "Acme Business Group dev",
"state": "creating",
"type": "development",
"region": "VA7"
}
state
會變成「作用中」或「失敗」。建立生產沙箱
若要建立生產沙箱,您必須在要求裝載中提供值為production
的type
屬性。
API格式
POST /sandboxes
要求
以下請求會建立名為「acme」的新生產沙箱。
curl -X POST \
https://platform.adobe.io/data/foundation/sandbox-management/sandboxes \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {ORG_ID}' \
-H `Accept: application/json` \
-H 'Content-Type: application/json' \
-d '{
"name": "acme",
"title": "Acme Business Group",
"type": "production"
}'
name
title
type
production
。回應
成功的回應會傳回新建立的沙箱的詳細資料,顯示其state
正在「建立」。
{
"name": "acme",
"title": "Acme Business Group",
"state": "creating",
"type": "production",
"region": "VA7"
}
state
會變成「作用中」或「失敗」。更新沙箱 put
您可以透過提出PATCH請求來更新沙箱中的一個或多個欄位,該請求在請求路徑中包含沙箱的name
以及在請求承載中要更新的屬性。
title
屬性。API格式
PATCH /sandboxes/{SANDBOX_NAME}
{SANDBOX_NAME}
name
屬性。要求
以下請求會更新名為「acme」的沙箱的title
屬性。
curl -X PATCH \
https://platform.adobe.io/data/foundation/sandbox-management/sandboxes/acme \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {ORG_ID}' \
-H 'Content-Type: application/json'
-d '{
"title": "Acme Business Group prod"
}'
回應
成功的回應會傳回HTTP狀態200 (確定)以及新更新沙箱的詳細資訊。
{
"name": "acme",
"title": "Acme Business Group prod",
"state": "active",
"type": "production",
"region": "VA7"
}
重設沙箱 reset
沙箱具有「原廠重設」功能,可從沙箱中刪除所有非預設資源。 您可以透過在請求路徑中包含沙箱的name
的PUT請求來重設沙箱。
API格式
PUT /sandboxes/{SANDBOX_NAME}
{SANDBOX_NAME}
name
屬性。validationOnly
validationOnly=true
,以檢查您即將重設的沙箱是否包含任何Adobe Analytics、Adobe Audience Manager或區段共用資料。要求
以下請求會重設名為「acme-dev」的沙箱。
curl -X PUT \
https://platform.adobe.io/data/foundation/sandbox-management/sandboxes/acme-dev?validationOnly=true \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {ORG_ID}' \
-H 'Content-Type: application/json'
-d '{
"action": "reset"
}'
action
回應
成功的回應會傳回更新沙箱的詳細資料,顯示其state
正在「重設」。
{
"id": "d8184350-dbf5-11e9-875f-6bf1873fec16",
"name": "acme-dev",
"title": "Acme Business Group dev",
"state": "resetting",
"type": "development",
"region": "VA7"
}
如果其中代管的身分圖表也被Adobe Analytics用於跨裝置分析(CDA)功能,或其中代管的身分圖表也被Adobe Audience Manager用於以人為基礎的目的地(PBD)功能,則無法重設預設生產沙箱和任何使用者建立的生產沙箱。
以下是可防止沙箱重設的可能例外清單:
{
"status": 400,
"title": "Sandbox `{SANDBOX_NAME}` cannot be reset. The identity graph hosted in this sandbox is also being used by Adobe Analytics for the Cross Device Analytics (CDA) feature.",
"type": "http://ns.adobe.com/aep/errors/SMS-2074-400"
},
{
"status": 400,
"title": "Sandbox `{SANDBOX_NAME}` cannot be reset. The identity graph hosted in this sandbox is also being used by Adobe Audience Manager for the People Based Destinations (PBD) feature.",
"type": "http://ns.adobe.com/aep/errors/SMS-2075-400"
},
{
"status": 400,
"title": "Sandbox `{SANDBOX_NAME}` cannot be reset. The identity graph hosted in this sandbox is also being used by Adobe Audience Manager for the People Based Destinations (PBD) feature, as well by Adobe Analytics for the Cross Device Analytics (CDA) feature.",
"type": "http://ns.adobe.com/aep/errors/SMS-2076-400"
},
{
"status": 400,
"title": "Warning: Sandbox `{SANDBOX_NAME}` is used for bi-directional segment sharing with Adobe Audience Manager or Audience Core Service.",
"type": "http://ns.adobe.com/aep/errors/SMS-2077-400"
}
您可以繼續重設用來與Audience Manager或Audience Core Service進行雙向區段共用的生產沙箱,方法是在您的要求中新增ignoreWarnings
引數。
API格式
PUT /sandboxes/{SANDBOX_NAME}?ignoreWarnings=true
{SANDBOX_NAME}
name
屬性。ignoreWarnings
要求
以下請求會重設名為「acme」的生產沙箱。
curl -X PUT \
https://platform.adobe.io/data/foundation/sandbox-management/sandboxes/acme?ignoreWarnings=true \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {ORG_ID}' \
-H 'Content-Type: application/json'
-d '{
"action": "reset"
}'
回應
成功的回應會傳回更新沙箱的詳細資料,顯示其state
正在「重設」。
{
"id": "d8184350-dbf5-11e9-875f-6bf1873fec16",
"name": "acme",
"title": "Acme Business Group prod",
"state": "resetting",
"type": "production",
"region": "VA7"
}
刪除沙箱 delete
您可以透過在請求路徑中包含沙箱的name
的DELETE請求來刪除沙箱。
status
屬性更新為「已刪除」並將其停用。 刪除沙箱後,GET請求仍可擷取沙箱的詳細資料。API格式
DELETE /sandboxes/{SANDBOX_NAME}
{SANDBOX_NAME}
name
。validationOnly
validationOnly=true
,以檢查您即將重設的沙箱是否包含任何Adobe Analytics、Adobe Audience Manager或區段共用資料。ignoreWarnings
要求
以下請求會刪除名為「acme」的生產沙箱。
curl -X DELETE \
https://platform.adobe.io/data/foundation/sandbox-management/sandboxes/acme?ignoreWarnings=true \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {ORG_ID}'
回應
成功的回應會傳回沙箱的更新詳細資料,顯示其state
已「刪除」。
{
"name": "acme",
"title": "Acme Business Group prod",
"state": "deleted",
"type": "development",
"region": "VA7"
}