ミックスインは、個人、住所、Webブラウザー環境など、特定の概念を表す1つ以上のフィールドを定義する再利用可能なコンポーネントです。 ミックスインは、表すデータの動作(レコードまたは時系列)に応じて、互換性のあるクラスを実装するスキーマの一部として含めることを意図しています。 Schema Registry APIの/mixins
エンドポイントを使用すると、エクスペリエンスアプリケーション内のミックスインをプログラムで管理できます。
このガイドで使用されるエンドポイントは、Schema Registry APIの一部です。 先に進む前に、はじめにを読んで、関連ドキュメントへのリンク、このドキュメントのサンプルAPI呼び出しを読むためのガイド、Experience PlatformAPIの呼び出しを正常に行うために必要なヘッダーに関する重要な情報を確認してください。
global
とtenant
のコンテナーで、それぞれ/global/mixins
と/tenant/mixins
にGETリクエストを行うことで、すべてのミックスインをリストできます。
リソースをリストする場合、スキーマレジストリでは結果セットが300項目に制限されます。 この制限を超えるリソースを返すには、ページングパラメーターを使用する必要があります。 また、結果をフィルターし、返されるリソースの数を減らすために、追加のクエリパラメーターを使用することもお勧めします。 詳しくは、付録ドキュメントのクエリパラメーターの節を参照してください。
API 形式
GET /{CONTAINER_ID}/mixins?{QUERY_PARAMS}
パラメーター | 説明 |
---|---|
{CONTAINER_ID} |
ミックスインの取得元のコンテナ:global はAdobeが作成したミックスイン用、tenant は組織が所有するミックスイン用です。 |
{QUERY_PARAMS} |
結果をフィルターするオプションのクエリパラメーター。使用可能なパラメーターのリストについては、付録ドキュメントを参照してください。 |
リクエスト
次のリクエストは、tenant
コンテナーからミックスインのリストを取得し、orderby
クエリーパラメーターを使用してtitle
属性でミックスインを並べ替えます。
curl -X GET \
https://platform.adobe.io/data/foundation/schemaregistry/tenant/mixins?orderby=title \
-H 'Accept: application/vnd.adobe.xed-id+json' \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {IMS_ORG}' \
-H 'x-sandbox-name: {SANDBOX_NAME}'
応答の形式は、リクエストで送信されるAccept
ヘッダーに依存します。 ミックスインのリストには、次のAccept
ヘッダーを使用できます。
Accept ヘッダー |
説明 |
---|---|
application/vnd.adobe.xed-id+json |
各リソースの短い概要を返します。 リソースのリストを表示する際に推奨されるヘッダーです。 (制限:300) |
application/vnd.adobe.xed+json |
各リソースに対して、オリジナルの$ref とallOf を含む完全なJSONミックスインを返します。 (制限:300) |
応答
上記のリクエストはapplication/vnd.adobe.xed-id+json
Accept
ヘッダーを使用していたので、応答には各ミックスインのtitle
、$id
、meta:altId
、version
属性のみが含まれます。 他のAccept
ヘッダ(application/vnd.adobe.xed+json
)を使用すると、各ミックスインのすべての属性が返されます。 回答で必要な情報に応じて、適切なAccept
ヘッダーを選択します。
{
"results": [
{
"$id": "https://ns.adobe.com/{TENANT_ID}/mixins/6ece98e9842907c78c651f5b249d9f09",
"meta:altId": "_{TENANT_ID}.mixins.6ece98e9842907c78c651f5b249d9f09",
"version": "1.0",
"title": "CRM Data"
},
{
"$id": "https://ns.adobe.com/{TENANT_ID}/mixins/6386ee478a30914964c6e676ad55603c",
"meta:altId": "_{TENANT_ID}.mixins.6386ee478a30914964c6e676ad55603c",
"version": "1.9",
"title": "Loyalty Member Details"
},
{
"$id": "https://ns.adobe.com/{TENANT_ID}/mixins/67626b2830db3d3ea6c8f9d007aa5797",
"meta:altId": "_{TENANT_ID}.mixins.67626b2830db3d3ea6c8f9d007aa5797",
"version": "1.0",
"title": "Restaurant"
},
{
"$id": "https://ns.adobe.com/{TENANT_ID}/mixins/2583b25b613fec704da6ef70cf527688",
"meta:altId": "_{TENANT_ID}.mixins.2583b25b613fec704da6ef70cf527688",
"version": "1.1",
"title": "Retail Customer Preferences"
},
],
"_page": {
"orderby": "title",
"next": null,
"count": 3
},
"_links": {
"next": null,
"global_schemas": {
"href": "https://platform.adobe.io/data/foundation/schemaregistry/global/mixins"
}
}
}
GETリクエストのパスにmixinのIDを含めると、特定のmixinを検索できます。
API 形式
GET /{CONTAINER_ID}/mixins/{MIXIN_ID}
パラメーター | 説明 |
---|---|
{CONTAINER_ID} |
取得するミックスインを格納するコンテナ:Adobeが作成したmixinの場合はglobal 、組織が所有するmixinの場合はtenant です。 |
{MIXIN_ID} |
検索するミックスインのmeta:altId またはURLエンコードされた$id 。 |
リクエスト
次のリクエストは、パスに指定されたmeta:altId
値によってミックスインを取得します。
curl -X GET \
https://platform.adobe.io/data/foundation/schemaregistry/tenant/mixins/_{TENANT_ID}.mixins.8779fd45d6e4eb074300023a439862bbba359b60d451627a \
-H 'Accept: application/vnd.adobe.xed+json' \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {IMS_ORG}' \
-H 'x-sandbox-name: {SANDBOX_NAME}'
応答の形式は、リクエストで送信されるAccept
ヘッダーに依存します。 すべての参照リクエストで、version
をAccept
ヘッダーに含める必要があります。 次のAccept
ヘッダーを使用できます。
Accept ヘッダー |
説明 |
---|---|
application/vnd.adobe.xed+json; version=1 |
$ref および allOf で生、タイトルと説明を含む |
application/vnd.adobe.xed-full+json; version=1 |
$ref および allOf を解決、タイトルと説明を含む |
application/vnd.adobe.xed-notext+json; version=1 |
$ref および allOf で生、タイトルや説明なし |
application/vnd.adobe.xed-full-notext+json; version=1 |
$ref および allOf で解決、タイトルや説明なし |
application/vnd.adobe.xed-full-desc+json; version=1 |
$ref および allOf で解決、説明を含む |
応答
正常に応答すると、ミックスインの詳細が返されます。 返されるフィールドは、リクエストで送信されるAccept
ヘッダーによって異なります。 異なるAccept
ヘッダーを試して、回答を比較し、使用事例に最適なヘッダーを判断します。
{
"$id": "https://ns.adobe.com/{TENANT_ID}/mixins/8779fd45d6e4eb074300023a439862bbba359b60d451627a",
"meta:altId": "_{TENANT_ID}.mixins.8779fd45d6e4eb074300023a439862bbba359b60d451627a",
"meta:resourceType": "mixins",
"version": "1.2",
"title": "Favorite Hotel",
"type": "object",
"description": "",
"definitions": {
"customFields": {
"type": "object",
"properties": {
"_{TENANT_ID}": {
"type": "object",
"properties": {
"favoriteHotel": {
"title": "Favorite Hotel",
"description": "Reference field for hotel schema.",
"type": "string",
"isRequired": false,
"meta:xdmType": "string"
}
},
"meta:xdmType": "object"
}
},
"meta:xdmType": "object"
}
},
"allOf": [
{
"$ref": "#/definitions/customFields",
"type": "object",
"meta:xdmType": "object"
}
],
"imsOrg": "{IMS_ORG}",
"meta:extensible": true,
"meta:abstract": true,
"meta:intendedToExtend": [
"https://ns.adobe.com/xdm/context/profile"
],
"meta:xdmType": "object",
"meta:registryMetadata": {
"repo:createdDate": 1594941263588,
"repo:lastModifiedDate": 1594941538433,
"xdm:createdClientId": "{CLIENT_ID}",
"xdm:lastModifiedClientId": "{CLIENT_ID}",
"xdm:createdUserId": "{USER_ID}",
"xdm:lastModifiedUserId": "{USER_ID}",
"eTag": "5e8a5e508eb2ed344c08cb23ed27cfb60c841bec59a2f7513deda0f7af903021",
"meta:globalLibVersion": "1.15.4"
},
"meta:containerId": "tenant",
"meta:tenantNamespace": "_{TENANT_ID}"
}
POSTリクエストを行うことで、tenant
コンテナの下にカスタムミックスインを定義できます。
API 形式
POST /tenant/mixins
リクエスト
新しい mixin を定義する場合は、meta:intendedToExtend
属性を含めて、その mixin と互換性があるクラスの $id
をリストする必要があります。この例では、ミックスインは、以前に定義されたProperty
クラスと互換性があります。 クラスや他のミックスインで提供される同様のフィールドとの衝突を回避するために、カスタムフィールドは_{TENANT_ID}
の下(例に示すように)にネストする必要があります。
ミックスインに含める各種フィールドの定義方法の詳細については、フィールド制約ガイドを参照してください。
curl -X POST \
https://platform.adobe.io/data/foundation/schemaregistry/tenant/mixins \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'Content-Type: application/json' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {IMS_ORG}' \
-H 'x-sandbox-name: {SANDBOX_NAME}' \
-d '{
"title":"Property Details",
"description":"Detailed information related to the properties owned and operated by the company.",
"type":"object",
"meta:intendedToExtend":["https://ns.adobe.com/{TENANT_ID}/classes/19e1d8b5098a7a76e2c10a81cbc99590"],
"definitions": {
"property": {
"properties": {
"_{TENANT_ID}": {
"type":"object",
"properties": {
"propertyName": {
"type": "string",
"title": "Property Name",
"description": "Name of the property"
},
"propertyCity": {
"title": "Property City",
"description": "City where the property is located.",
"type": "string"
},
"phoneNumber": {
"title": "Phone Number",
"description": "Primary phone number for the property.",
"type": "string"
},
"propertyType": {
"type": "string",
"title": "Property Type",
"description": "Type and primary use of property.",
"enum": [
"retail",
"yoga",
"fitness"
],
"meta:enum": {
"retail": "Retail Store",
"yoga": "Yoga Studio",
"fitness": "Fitness Center"
}
},
"propertyConstruction": {
"$ref": "https://ns.adobe.com/{TENANT_ID}/datatypes/24c643f618647344606222c494bd0102"
}
}
}
}
}
},
"allOf": [
{
"$ref": "#/definitions/property"
}
]
}'
応答
成功した応答は、HTTP ステータス 201 (Created)と、新しく作成された mixin の詳細($id
、meta:altId
、version
など)を含むペイロードを返します。これらの値は読み取り専用で、Schema Registryによって割り当てられます。
{
"$id": "https://ns.adobe.com/{TENANT_ID}/mixins/8779fd45d6e4eb074300023a439862bbba359b60d451627a",
"meta:altId": "_{TENANT_ID}.mixins.8779fd45d6e4eb074300023a439862bbba359b60d451627a",
"meta:resourceType": "mixins",
"version": "1.2",
"title": "Property Details",
"type": "object",
"description": "Detailed information related to the properties owned and operated by the company.",
"definitions": {
"property": {
"properties": {
"_{TENANT_ID}": {
"type":"object",
"properties": {
"propertyName": {
"type": "string",
"title": "Property Name",
"description": "Name of the property"
},
"propertyCity": {
"title": "Property City",
"description": "City where the property is located.",
"type": "string"
},
"phoneNumber": {
"title": "Phone Number",
"description": "Primary phone number for the property.",
"type": "string"
},
"propertyType": {
"type": "string",
"title": "Property Type",
"description": "Type and primary use of property.",
"enum": [
"retail",
"yoga",
"fitness"
],
"meta:enum": {
"retail": "Retail Store",
"yoga": "Yoga Studio",
"fitness": "Fitness Center"
}
},
"propertyConstruction": {
"$ref": "https://ns.adobe.com/{TENANT_ID}/datatypes/24c643f618647344606222c494bd0102"
}
}
}
}
}
},
"allOf": [
{
"$ref": "#/definitions/customFields",
"type": "object",
"meta:xdmType": "object"
}
],
"imsOrg": "{IMS_ORG}",
"meta:extensible": true,
"meta:abstract": true,
"meta:intendedToExtend": [
"https://ns.adobe.com/xdm/context/profile"
],
"meta:xdmType": "object",
"meta:registryMetadata": {
"repo:createdDate": 1594941263588,
"repo:lastModifiedDate": 1594941538433,
"xdm:createdClientId": "{CLIENT_ID}",
"xdm:lastModifiedClientId": "{CLIENT_ID}",
"xdm:createdUserId": "{USER_ID}",
"xdm:lastModifiedUserId": "{USER_ID}",
"eTag": "5e8a5e508eb2ed344c08cb23ed27cfb60c841bec59a2f7513deda0f7af903021",
"meta:globalLibVersion": "1.15.4"
},
"meta:containerId": "tenant",
"meta:tenantNamespace": "_{TENANT_ID}"
}
テナントコンテナ内のすべてのミックスイン](#list)に対するGET要求をリストすると、プロパティの詳細ミックスインが含まれるようになりました。または、URLエンコードされた$id
URIを使用してルックアップ(GET)要求を実行し、新しいmixinを直接表示できます。[
PUT操作を使用してミックスイン全体を置き換え、基本的にリソースを書き直すことができます。 PUT要求を通じてMixinを更新する場合、本文には、POST要求で新しいMixinを作成する際に必要となるすべてのフィールドを含める必要があります。
完全に置き換える代わりに、mixinの一部だけを更新したい場合は、mixinの](#patch)部分を更新する[の節を参照してください。
API 形式
PUT /tenant/mixins/{MIXIN_ID}
パラメーター | 説明 |
---|---|
{MIXIN_ID} |
再書き込みするミックスインのmeta:altId またはURLエンコードされた$id 。 |
リクエスト
次のリクエストは、新しいpropertyCountry
フィールドを追加して、既存のミックスインを書き直します。
curl -X PUT \
https://platform.adobe.io/data/foundation/schemaregistry/tenant/mixins/_{TENANT_ID}.mixins.8779fd45d6e4eb074300023a439862bbba359b60d451627a \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'Content-Type: application/json' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {IMS_ORG}' \
-H 'x-sandbox-name: {SANDBOX_NAME}' \
-d '{
"title": "Property Details",
"description": "Detailed information related to the properties owned and operated by the company.",
"type": "object",
"meta:intendedToExtend": ["https://ns.adobe.com/{TENANT_ID}/classes/19e1d8b5098a7a76e2c10a81cbc99590"],
"definitions": {
"property": {
"properties": {
"_{TENANT_ID}": {
"type":"object",
"properties": {
"propertyName": {
"type": "string",
"title": "Property Name",
"description": "Name of the property"
},
"propertyCity": {
"title": "Property City",
"description": "City where the property is located.",
"type": "string"
},
"propertyCountry": {
"title": "Property Country",
"description": "Country where the property is located.",
"type": "string"
},
"phoneNumber": {
"title": "Phone Number",
"description": "Primary phone number for the property.",
"type": "string"
},
"propertyType": {
"type": "string",
"title": "Property Type",
"description": "Type and primary use of property.",
"enum": [
"retail",
"yoga",
"fitness"
],
"meta:enum": {
"retail": "Retail Store",
"yoga": "Yoga Studio",
"fitness": "Fitness Center"
}
},
"propertyConstruction": {
"$ref": "https://ns.adobe.com/{TENANT_ID}/datatypes/24c643f618647344606222c494bd0102"
}
}
}
}
}
},
"allOf": [
{
"$ref": "#/definitions/property"
}
]
}'
応答
正常に応答すると、更新されたミックスインの詳細が返されます。
{
"$id": "https://ns.adobe.com/{TENANT_ID}/mixins/8779fd45d6e4eb074300023a439862bbba359b60d451627a",
"meta:altId": "_{TENANT_ID}.mixins.8779fd45d6e4eb074300023a439862bbba359b60d451627a",
"meta:resourceType": "mixins",
"version": "1.2",
"title": "Property Details",
"type": "object",
"description": "Detailed information related to the properties owned and operated by the company.",
"definitions": {
"property": {
"properties": {
"_{TENANT_ID}": {
"type":"object",
"properties": {
"propertyName": {
"type": "string",
"title": "Property Name",
"description": "Name of the property"
},
"propertyCity": {
"title": "Property City",
"description": "City where the property is located.",
"type": "string"
},
"propertyCountry": {
"title": "Property Country",
"description": "Country where the property is located.",
"type": "string"
},
"phoneNumber": {
"title": "Phone Number",
"description": "Primary phone number for the property.",
"type": "string"
},
"propertyType": {
"type": "string",
"title": "Property Type",
"description": "Type and primary use of property.",
"enum": [
"retail",
"yoga",
"fitness"
],
"meta:enum": {
"retail": "Retail Store",
"yoga": "Yoga Studio",
"fitness": "Fitness Center"
}
},
"propertyConstruction": {
"$ref": "https://ns.adobe.com/{TENANT_ID}/datatypes/24c643f618647344606222c494bd0102"
}
}
}
}
}
},
"allOf": [
{
"$ref": "#/definitions/customFields",
"type": "object",
"meta:xdmType": "object"
}
],
"imsOrg": "{IMS_ORG}",
"meta:extensible": true,
"meta:abstract": true,
"meta:intendedToExtend": [
"https://ns.adobe.com/xdm/context/profile"
],
"meta:xdmType": "object",
"meta:registryMetadata": {
"repo:createdDate": 1594941263588,
"repo:lastModifiedDate": 1594941538433,
"xdm:createdClientId": "{CLIENT_ID}",
"xdm:lastModifiedClientId": "{CLIENT_ID}",
"xdm:createdUserId": "{USER_ID}",
"xdm:lastModifiedUserId": "{USER_ID}",
"eTag": "5e8a5e508eb2ed344c08cb23ed27cfb60c841bec59a2f7513deda0f7af903021",
"meta:globalLibVersion": "1.15.4"
},
"meta:containerId": "tenant",
"meta:tenantNamespace": "_{TENANT_ID}"
}
PATCHリクエストを使用して、ミックスインの一部を更新できます。 Schema Registryは、add
、remove
、replace
を含む、すべての標準的なJSONパッチ操作をサポートしています。 JSONパッチについて詳しくは、APIの基本的なガイドを参照してください。
個々のフィールドを更新する代わりに、リソース全体を新しい値に置き換える場合は、PUT演算を使用したmixinの置き換えの節を参照してください。
API 形式
PATCH /tenant/mixin/{MIXIN_ID}
パラメーター | 説明 |
---|---|
{MIXIN_ID} |
更新するミックスインのURLエンコードされた$id URIまたはmeta:altId 。 |
リクエスト
以下のリクエスト例では、既存のmixinのdescription
を更新し、新しいpropertyCity
フィールドを追加します。
リクエスト本体は配列の形をとり、リストに表示された各オブジェクトは個々のフィールドに対する特定の変更を表します。 各オブジェクトは、実行する操作(op
)、操作を実行するフィールド(path
)、およびその操作に含める情報(value
)を含む。
curl -X PATCH \
https://platform.adobe.io/data/foundation/schemaregistry/tenant/mixins/_{TENANT_ID}.mixins.8779fd45d6e4eb074300023a439862bbba359b60d451627a \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {IMS_ORG}' \
-H 'x-sandbox-name: {SANDBOX_NAME}' \
-H 'content-type: application/json' \
-d '[
{
"op": "replace",
"path": "/description",
"value": "Details relating to a property operated by the company."
},
{
"op": "add",
"path": "/definitions/property/properties/_{TENANT_ID}/properties/propertyCity",
"value": {
"title": "Property City",
"description": "City where the property is located.",
"type": "string"
}
}
]'
応答
応答には、両方の操作が正常に実行されたことが示されます。description
が更新され、propertyCountry
がdefinitions
に追加されました。
{
"$id": "https://ns.adobe.com/{TENANT_ID}/mixins/8779fd45d6e4eb074300023a439862bbba359b60d451627a",
"meta:altId": "_{TENANT_ID}.mixins.8779fd45d6e4eb074300023a439862bbba359b60d451627a",
"meta:resourceType": "mixins",
"version": "1.2",
"title": "Property Details",
"type": "object",
"description": "Details relating to a property operated by the company.",
"definitions": {
"property": {
"properties": {
"_{TENANT_ID}": {
"type":"object",
"properties": {
"propertyName": {
"type": "string",
"title": "Property Name",
"description": "Name of the property"
},
"propertyCity": {
"title": "Property City",
"description": "City where the property is located.",
"type": "string"
},
"propertyCountry": {
"title": "Property Country",
"description": "Country where the property is located.",
"type": "string"
},
"phoneNumber": {
"title": "Phone Number",
"description": "Primary phone number for the property.",
"type": "string"
},
"propertyType": {
"type": "string",
"title": "Property Type",
"description": "Type and primary use of property.",
"enum": [
"retail",
"yoga",
"fitness"
],
"meta:enum": {
"retail": "Retail Store",
"yoga": "Yoga Studio",
"fitness": "Fitness Center"
}
},
"propertyConstruction": {
"$ref": "https://ns.adobe.com/{TENANT_ID}/datatypes/24c643f618647344606222c494bd0102"
}
}
}
}
}
},
"allOf": [
{
"$ref": "#/definitions/customFields",
"type": "object",
"meta:xdmType": "object"
}
],
"imsOrg": "{IMS_ORG}",
"meta:extensible": true,
"meta:abstract": true,
"meta:intendedToExtend": [
"https://ns.adobe.com/xdm/context/profile"
],
"meta:xdmType": "object",
"meta:registryMetadata": {
"repo:createdDate": 1594941263588,
"repo:lastModifiedDate": 1594941538433,
"xdm:createdClientId": "{CLIENT_ID}",
"xdm:lastModifiedClientId": "{CLIENT_ID}",
"xdm:createdUserId": "{USER_ID}",
"xdm:lastModifiedUserId": "{USER_ID}",
"eTag": "5e8a5e508eb2ed344c08cb23ed27cfb60c841bec59a2f7513deda0f7af903021",
"meta:globalLibVersion": "1.15.4"
},
"meta:containerId": "tenant",
"meta:tenantNamespace": "_{TENANT_ID}"
}
スキーマレジストリからミックスインを削除する必要がある場合があります。 これは、パスに指定されたミックスインIDを使用してDELETEリクエストを実行することで行われます。
API 形式
DELETE /tenant/mixins/{MIXIN_ID}
パラメーター | 説明 |
---|---|
{MIXIN_ID} |
削除するミックスインのURLエンコードされた$id URIまたはmeta:altId 。 |
リクエスト
curl -X DELETE \
https://platform.adobe.io/data/foundation/schemaregistry/tenant/mixins/_{TENANT_ID}.mixins.d5cc04eb8d50190001287e4c869ebe67 \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {IMS_ORG}' \
-H 'x-sandbox-name: {SANDBOX_NAME}'
応答
正常な応答は、空白の本文とともに HTTP ステータス 204(コンテンツなし)を返します。
ルックアップ(GET)リクエストをミックスインに対して試行することで、削除を確認できます。 リクエストにAccept
ヘッダーを含める必要がありますが、スキーマレジストリからmixinが削除されたので、HTTPステータス404 (見つかりません)を受け取る必要があります。