スキーマフィールドグループエンドポイント
スキーマフィールドグループは、個人、郵送先住所、web ブラウザー環境など、特定のコンセプトを表す1つ以上のフィールドを定義する再利用可能なコンポーネントです。 フィールドグループは、表すデータの動作(レコードまたは時系列)に応じて、互換性のあるクラスを実装するスキーマの一部として含めることを目的としています。 Schema Registry APIの/fieldgroups エンドポイントを使用すると、エクスペリエンスアプリケーション内のフィールドグループをプログラムで管理できます。
はじめに
このガイドで使用されているエンドポイントは、Schema Registry APIの一部です。 先に進む前に、はじめる前にを参照し、関連ドキュメントへのリンク、このドキュメントのサンプル API 呼び出しを読み取るためのガイドおよび任意の Experience Platform API を正常に呼び出すために必要なヘッダーに関する重要な情報を確認してください。
フィールドグループのリストの取得 list
globalまたはtenant コンテナの下にあるすべてのフィールドグループを一覧表示するには、それぞれ/global/fieldgroupsまたは/tenant/fieldgroupsにGET リクエストを行います。
API 形式
GET /{CONTAINER_ID}/fieldgroups?{QUERY_PARAMS}
{CONTAINER_ID}globalまたは自社が所有するフィールドグループのtenantからフィールドグループを取得するコンテナ。{QUERY_PARAMS}リクエスト
次のリクエストは、orderby クエリパラメーターを使用して、tenant コンテナからフィールドグループのリストを取得し、title属性でフィールドグループを並べ替えます。
curl -X GET \
https://platform.adobe.io/data/foundation/schemaregistry/tenant/fieldgroups?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: {ORG_ID}' \
-H 'x-sandbox-name: {SANDBOX_NAME}'
応答の形式は、リクエストで送信されたAccept ヘッダーによって異なります。 フィールドグループの一覧表示には、次のAccept ヘッダーを使用できます。
Accept ヘッダーapplication/vnd.adobe.xed-id+jsonapplication/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/fieldgroups"
}
}
}
フィールドグループの検索 lookup
GET リクエストのパスにフィールドグループのIDを含めることで、特定のフィールドグループを検索できます。
API 形式
GET /{CONTAINER_ID}/fieldgroups/{FIELD_GROUP_ID}
{CONTAINER_ID}global、または組織が所有するフィールドグループのtenant。{FIELD_GROUP_ID}meta:altIdまたはURL エンコードされた$idです。リクエスト
次のリクエストは、パスで指定されたmeta:altId値でフィールドグループを取得します。
curl -X GET \
https://platform.adobe.io/data/foundation/schemaregistry/tenant/fieldgroups/_{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: {ORG_ID}' \
-H 'x-sandbox-name: {SANDBOX_NAME}'
応答の形式は、リクエストで送信されたAccept ヘッダーによって異なります。 すべてのルックアップリクエストでは、versionをAccept ヘッダーに含める必要があります。 次のAccept ヘッダーを使用できます。
Accept ヘッダーapplication/vnd.adobe.xed+json; version={MAJOR_VERSION}$ref および allOf で生、タイトルと説明を含むapplication/vnd.adobe.xed-full+json; version={MAJOR_VERSION}$ref および allOf を解決、タイトルと説明を含むapplication/vnd.adobe.xed-notext+json; version={MAJOR_VERSION}$ref および allOf で生、タイトルや説明なしapplication/vnd.adobe.xed-full-notext+json; version={MAJOR_VERSION}$ref および allOf で解決、タイトルや説明なしapplication/vnd.adobe.xed-full-desc+json; version={MAJOR_VERSION}$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": "{ORG_ID}",
"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}"
}
フィールドグループの作成 create
POST リクエストを行うことで、tenant コンテナの下にカスタムフィールドグループを定義できます。
API 形式
POST /tenant/fieldgroups
リクエスト
新しいフィールドグループを定義する場合は、フィールドグループに互換性のあるクラスの$idをリストするmeta:intendedToExtend属性を含める必要があります。 この例では、フィールドグループは、以前に定義したProperty クラスと互換性があります。 クラスや他のフィールドグループによって提供される類似フィールドとの競合を避けるために、カスタムフィールドを_{TENANT_ID}の下にネストする必要があります(例を参照)。
curl -X POST \
https://platform.adobe.io/data/foundation/schemaregistry/tenant/fieldgroups \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'Content-Type: application/json' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {ORG_ID}' \
-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 (作成済み)と、新しく作成されたフィールドグループ ($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": "{ORG_ID}",
"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}"
}
テナントコンテナ内のすべてのフィールドグループ 🔗を一覧表示するGET リクエストを実行すると、プロパティの詳細フィールドグループが含まれるようになり、URL エンコードされた$id URIを使用してルックアップ (GET) リクエスト を実行し、新しいフィールドグループを直接表示できるようになりました。
フィールドグループの更新 put
PUT操作を使用してフィールドグループ全体を置き換え、基本的にリソースを書き換えることができます。 PUT リクエストを使用してフィールドグループを更新する場合、本文には、POST リクエストで新しいフィールドグループ を作成するときに必要なすべてのフィールドを含める必要があります。
API 形式
PUT /tenant/fieldgroups/{FIELD_GROUP_ID}
{FIELD_GROUP_ID}meta:altIdまたはURL エンコードされた$id。リクエスト
次のリクエストは、既存のフィールドグループを書き換え、新しいpropertyCountry フィールドを追加します。
curl -X PUT \
https://platform.adobe.io/data/foundation/schemaregistry/tenant/fieldgroups/_{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: {ORG_ID}' \
-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": "{ORG_ID}",
"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
PATCH リクエストを使用すると、フィールドグループの一部を更新できます。 Schema Registryは、add、removeおよびreplaceを含むすべての標準JSON パッチ操作をサポートしています。 JSON パッチについて詳しくは、API の基本ガイドを参照してください。
API 形式
PATCH /tenant/fieldgroups/{FIELD_GROUP_ID}
{FIELD_GROUP_ID}$id URIまたはmeta:altId。リクエスト
次のリクエスト例は、既存のフィールドグループのdescriptionを更新し、新しいpropertyCity フィールドを追加します。
リクエスト本文は配列の形式を取り、各リストオブジェクトは個々のフィールドに対する特定の変更を表します。 各オブジェクトには、実行する操作(op)、操作を実行するフィールド(path)、その操作(value)に含める情報が含まれます。
curl -X PATCH \
https://platform.adobe.io/data/foundation/schemaregistry/tenant/fieldgroups/_{TENANT_ID}.mixins.8779fd45d6e4eb074300023a439862bbba359b60d451627a \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {ORG_ID}' \
-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": "{ORG_ID}",
"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}"
}
フィールドグループの削除 delete
スキーマレジストリからフィールドグループを削除する必要がある場合があります。 これは、パスで指定されたフィールドグループ IDを使用してDELETE リクエストを実行することによって実行されます。
API 形式
DELETE /tenant/fieldgroups/{FIELD_GROUP_ID}
{FIELD_GROUP_ID}$id URIまたはmeta:altId。リクエスト
curl -X DELETE \
https://platform.adobe.io/data/foundation/schemaregistry/tenant/fieldgroups/_{TENANT_ID}.mixins.d5cc04eb8d50190001287e4c869ebe67 \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {ORG_ID}' \
-H 'x-sandbox-name: {SANDBOX_NAME}'
応答
正常な応答の場合は、空白の本文とともに HTTP ステータス 204 (コンテンツなし)が返されます。
フィールドグループに ルックアップ (GET) リクエスト を試行することで、削除を確認できます。 リクエストにAccept ヘッダーを含める必要がありますが、フィールドグループがスキーマレジストリから削除されたため、HTTP ステータス 404 (見つかりません)を受け取る必要があります。