沙盒管理端点
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
沙盒具有“工厂重置”功能,可从沙盒中删除所有非默认资源。 您可以通过在PUT路径中包含沙盒的name
来重置沙盒。
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也在其中托管的身份图形用于Cross Device 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"
}