データタイプエンドポイント
データ型は、クラスまたはスキーマフィールドグループの参照型フィールドとして、基本リテラルフィールドと同じ方法で使用されます。主な違いは、データ型が複数のサブフィールドを定義できる点です。 複数フィールド構造を一貫して使用できるという点でフィールドグループと同様ですが、データ型はスキーマ構造の任意の場所に含めることができるのに対して、ルートレベルでのみ追加できるので、より柔軟です。 The /datatypes
エンドポイント Schema Registry API を使用すると、エクスペリエンスアプリケーション内のデータタイプをプログラムで管理できます。
はじめに
このガイドで使用されるエンドポイントは、 Schema Registry API. 先に進む前に、はじめる前にを参照し、関連ドキュメントへのリンク、このドキュメントのサンプル API 呼び出しを読み取るためのガイドおよび任意の Experience Platform API を正常に呼び出すために必要なヘッダーに関する重要な情報を確認してください。
データタイプのリストの取得 list
すべてのデータタイプを global
または tenant
コンテナを作成するには、次に対してGETリクエストを実行します。 /global/datatypes
または /tenant/datatypes
、それぞれ。
API 形式
GET /{CONTAINER_ID}/datatypes?{QUERY_PARAMS}
{CONTAINER_ID}
global
(Adobe作成データタイプの場合 ) または tenant
(組織が所有するデータタイプの場合){QUERY_PARAMS}
リクエスト
次のリクエストでは、 tenant
コンテナ、使用 orderby
クエリパラメーターを使用して、データタイプを title
属性。
curl -X GET \
https://platform.adobe.io/data/foundation/schemaregistry/tenant/datatypes?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+json
application/vnd.adobe.xed+json
$ref
および allOf
含まれる。 (上限: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}/datatypes/78570e371092c032260714dd8bfd6d44",
"meta:altId": "_{TENANT_ID}.datatypes.78570e371092c032260714dd8bfd6d44",
"version": "1.0",
"title": "Loyalty"
},
{
"$id": "https://ns.adobe.com/{TENANT_ID}/datatypes/4b0329b5573cbb7cb757db667d7fdf66",
"meta:altId": "_{TENANT_ID}.datatypes.4b0329b5573cbb7cb757db667d7fdf66",
"version": "1.0",
"title": "Property Details"
}
],
"_page": {
"orderby": "title",
"next": null,
"count": 2
},
"_links": {
"next": null,
"global_schemas": {
"href": "https://platform.adobe.io/data/foundation/schemaregistry/global/datatypes?orderby=title"
}
}
}
データタイプの検索 lookup
データ型の ID をデータリクエストのパスに含めることで、特定のGET型を検索できます。
API 形式
GET /{CONTAINER_ID}/datatypes/{DATA_TYPE_ID}
{CONTAINER_ID}
global
(Adobeが作成したデータ型の場合 ) または tenant
組織が所有するデータ型の場合。{DATA_TYPE_ID}
meta:altId
または URL エンコード済み $id
検索するデータ型の値を指定します。リクエスト
次のリクエストでは、データタイプを meta:altId
の値がパスに指定されました。
curl -X GET \
https://platform.adobe.io/data/foundation/schemaregistry/tenant/datatypes/_{TENANT_ID}.datatypes.78570e371092c032260714dd8bfd6d44 \
-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=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}/datatypes/78570e371092c032260714dd8bfd6d44",
"meta:altId": "_{TENANT_ID}.datatypes.78570e371092c032260714dd8bfd6d44",
"meta:resourceType": "datatypes",
"version": "1.0",
"title": "Loyalty",
"type": "object",
"description": "Loyalty object containing loyalty-specific fields.",
"definitions": {
"customFields": {
"properties": {
"loyaltyId": {
"title": "Loyalty ID",
"description": "Unique loyalty program member ID. Should be in the format of an email address.",
"type": "string",
"meta:xdmType": "string"
},
"memberSince": {
"title": "Member Since",
"description": "Date person joined loyalty program.",
"type": "string",
"format": "date",
"meta:xdmType": "date"
},
"points": {
"title": "Points",
"description": "Accumulated loyalty points",
"type": "integer",
"meta:xdmType": "int"
},
"loyaltyLevel": {
"title": "Loyalty Level",
"description": "The current loyalty program level to which the individual member belongs.",
"type": "string",
"enum": [
"platinum",
"gold",
"silver",
"bronze"
],
"meta:enum": {
"platinum": "Platinum",
"gold": "Gold",
"silver": "Silver",
"bronze": "Bronze"
},
"meta:xdmType": "string"
}
},
"type": "object",
"meta:xdmType": "object"
}
},
"allOf": [
{
"$ref": "#/definitions/customFields"
}
],
"imsOrg": "{ORG_ID}",
"meta:extensible": true,
"meta:abstract": true,
"meta:xdmType": "object",
"meta:registryMetadata": {
"repo:createdDate": 1557529442681,
"repo:lastModifiedDate": 1557529442681,
"xdm:createdClientId": "{CLIENT_ID}",
"xdm:lastModifiedClientId": "{CLIENT_ID}",
"xdm:lastModifiedUserId": "{USER_ID}",
"eTag": "50b8008b588e911314f9685240dd4c23a247f37179a6d9ff6ba3877dc11ca504",
"meta:globalLibVersion": "1.15.4"
},
"meta:containerId": "tenant",
"meta:tenantNamespace": "_{TENANT_ID}"
}
データタイプの作成 create
カスタムデータタイプは、 tenant
コンテナを含める必要があります。POSTリクエストを実行します。
API 形式
POST /tenant/datatypes
リクエスト
フィールドグループとは異なり、データタイプを定義する場合には、 meta:extends
または meta:intendedToExtend
フィールドを入れ子にする必要はありません。衝突を避けるために、フィールドを入れ子にする必要はありません。
データ型自体のフィールド構造を定義する場合、以下のようなプリミティブ型を使用できます。 string
または object
を参照するか、 $ref
属性。 次のガイドを参照してください: API でのカスタム XDM フィールドの定義 を参照してください。
次のリクエストでは、サブプロパティを持つ「Property Construction」オブジェクトデータタイプが作成されます yearBuilt
, propertyType
、および location
:
curl -X POST \
https://platform.adobe.io/data/foundation/schemaregistry/tenant/datatypes \
-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 Construction",
"description": "Information related to the property construction",
"type": "object",
"properties": {
"yearBuilt": {
"type": "integer",
"title": "Year Built",
"description": "The year the property was constructed."
},
"propertyType": {
"type": "string",
"title": "Property Type",
"description": "Type of building or structure in which the property exists.",
"enum": [
"freeStanding",
"mall",
"shoppingCenter"
],
"meta:enum": {
"freeStanding": "Free Standing Building",
"mall": "Mall Space",
"shoppingCenter": "Shopping Center"
}
},
"location": {
"title": "Location",
"description": "The physical location of the property.",
"$ref": "https://ns.adobe.com/xdm/common/address"
}
}
}'
応答
正常な応答は、HTTP ステータス 201(作成済み)と、新しく作成されたデータタイプの詳細($id
、meta:altId
、version
を含む)を含むペイロードを返します。これらの 3 つの値は読み取り専用で、 Schema Registry.
{
"$id": "https://ns.adobe.com/{TENANT_ID}/datatypes/669ffcc61cf5e94e8640dbe6a15f0f24eb3cd1ddbbfb6b36",
"meta:altId": "_{TENANT_ID}.datatypes.669ffcc61cf5e94e8640dbe6a15f0f24eb3cd1ddbbfb6b36",
"meta:resourceType": "datatypes",
"version": "1.0",
"title": "Property Construction",
"type": "object",
"description": "Information related to the property construction",
"properties": {
"yearBuilt": {
"type": "integer",
"title": "Year Built",
"description": "The year the property was constructed.",
"meta:xdmType": "int"
},
"propertyType": {
"type": "string",
"title": "Property Type",
"description": "Type of building or structure in which the property exists.",
"enum": [
"freeStanding",
"mall",
"shoppingCenter"
],
"meta:enum": {
"freeStanding": "Free Standing Building",
"mall": "Mall Space",
"shoppingCenter": "Shopping Center"
},
"meta:xdmType": "string"
},
"location": {
"title": "Location",
"description": "The physical location of the property.",
"$ref": "https://ns.adobe.com/xdm/common/address",
"type": "object",
"meta:xdmType": "object"
}
},
"refs": [
"https://ns.adobe.com/xdm/common/address"
],
"imsOrg": "{ORG_ID}",
"meta:extensible": true,
"meta:abstract": true,
"meta:xdmType": "object",
"meta:registryMetadata": {
"repo:createdDate": 1670885230789,
"repo:lastModifiedDate": 1670885230789,
"xdm:createdClientId": "{CLIENT_ID}",
"xdm:lastModifiedClientId": "{CLIENT_ID}",
"xdm:createdUserId": "{USER_ID}",
"xdm:lastModifiedUserId": "{USER_ID}",
"eTag": "d3cc803a1f8daa06b7c150d882bd337d88f4d5d5f08d36cfc4c2849dc0255f7e",
"meta:globalLibVersion": "1.38.3.1"
},
"meta:containerId": "tenant",
"meta:sandboxId": "1bd86660-c5da-11e9-93d4-6d5fc3a66a8e",
"meta:sandboxType": "production",
"meta:tenantNamespace": "_{TENANT_ID}"
}
に対するGETリクエストの実行 すべてのデータタイプのリスト テナントコンテナにプロパティの詳細データ型が含まれるようになります。または、次の操作を実行できます。 ルックアップ (GET) リクエストの実行 URL エンコードされたを使用 $id
新しいデータ型を直接表示する URI。
データタイプの更新 put
データ型全体を置き換えるには、PUT操作を使用します。つまり、リソースを書き直す必要があります。 PUTリクエストを通じてデータ型を更新する場合、本文には、 新しいデータ型の作成 をPOSTします。
API 形式
PUT /tenant/datatypes/{DATA_TYPE_ID}
{DATA_TYPE_ID}
meta:altId
または URL エンコード済み $id
の値を指定します。リクエスト
次のリクエストは、新しい floorSize
フィールドに入力します。
curl -X PUT \
https://platform.adobe.io/data/foundation/schemaregistry/tenant/datatypes/_{TENANT_ID}.datatypes.7602bc6e97e5786a31c95d9e6531a1596687433451d97bc1 \
-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 Construction",
"description": "Information related to the property construction",
"type": "object",
"properties": {
"yearBuilt": {
"type": "integer",
"title": "Year Built",
"description": "The year the property was constructed."
},
"propertyType": {
"type": "string",
"title": "Property Type",
"description": "Type of building or structure in which the property exists.",
"enum": [
"freeStanding",
"mall",
"shoppingCenter"
],
"meta:enum": {
"freeStanding": "Free Standing Building",
"mall": "Mall Space",
"shoppingCenter": "Shopping Center"
}
},
"floorSize" {
"type": "integer",
"title": "Floor Size",
"description": "The floor size of the property, in square feet."
}
}
}'
応答
正常な応答は、更新されたデータタイプの詳細を返します。
{
"$id": "https://ns.adobe.com/{TENANT_ID}/datatypes/7602bc6e97e5786a31c95d9e6531a1596687433451d97bc1",
"meta:altId": "_{TENANT_ID}.datatypes.7602bc6e97e5786a31c95d9e6531a1596687433451d97bc1",
"meta:resourceType": "datatypes",
"version": "1.0",
"title": "Property Construction",
"type": "object",
"description": "Information related to the property construction",
"properties": {
"yearBuilt": {
"type": "integer",
"title": "Year Built",
"description": "The year the property was constructed.",
"meta:xdmType": "int"
},
"propertyType": {
"type": "string",
"title": "Property Type",
"description": "Type of building or structure in which the property exists.",
"enum": [
"freeStanding",
"mall",
"shoppingCenter"
],
"meta:enum": {
"freeStanding": "Free Standing Building",
"mall": "Mall Space",
"shoppingCenter": "Shopping Center"
},
"meta:xdmType": "string"
},
"floorSize" {
"type": "integer",
"title": "Floor Size",
"description": "The floor size of the property, in square feet.",
"meta:xdmType": "int"
}
},
"refs": [],
"imsOrg": "{ORG_ID}",
"meta:extensible": true,
"meta:abstract": true,
"meta:xdmType": "object",
"meta:registryMetadata": {
"repo:createdDate": 1604524729435,
"repo:lastModifiedDate": 1604524729435,
"xdm:createdClientId": "{CLIENT_ID}",
"xdm:lastModifiedClientId": "{CLIENT_ID}",
"xdm:createdUserId": "{USER_ID}",
"xdm:lastModifiedUserId": "{USER_ID}",
"eTag": "1c838764342756868ca1297869f582a38d15f03ed0acfc97fda7532d22e942c7",
"meta:globalLibVersion": "1.15.4"
},
"meta:containerId": "tenant",
"meta:sandboxId": "ff0f6870-c46d-11e9-8ca3-036939a64204",
"meta:sandboxType": "production",
"meta:tenantNamespace": "_{TENANT_ID}"
}
データタイプの一部を更新する patch
データ型の一部を更新するには、PATCHリクエストを使用します。 The Schema Registry は、以下を含むすべての標準的な JSON パッチ操作をサポートしています。 add
, remove
、および replace
. JSON パッチについて詳しくは、API の基本ガイドを参照してください。
API 形式
PATCH /tenant/data type/{DATA_TYPE_ID}
{DATA_TYPE_ID}
$id
URI or meta:altId
の値を指定します。リクエスト
以下のリクエスト例は、 description
を追加し、新しい floorSize
フィールドに入力します。
リクエスト本文は配列の形式をとり、リストに表示される各オブジェクトは個々のフィールドに対する特定の変更を表します。 各オブジェクトには、実行される操作 (op
) を呼び出し、操作を実行する必要があるフィールド (path
) と、その操作に含める必要のある情報 (value
) をクリックします。
curl -X PATCH \
https://platform.adobe.io/data/foundation/schemaregistry/tenant/datatypes/_{TENANT_ID}.datatypes.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": "Construction-related information for a company-operated property."
},
{
"op": "add",
"path": "/properties/floorSize",
"value": {
"type": "integer",
"title": "Floor Size",
"description": "The floor size of the property, in square feet."
}
}
]'
応答
応答には、両方の操作が正常に実行されたことが示されます。The description
が更新され、 floorSize
は以下に追加されています: definitions
.
{
"$id": "https://ns.adobe.com/{TENANT_ID}/datatypes/8779fd45d6e4eb074300023a439862bbba359b60d451627a",
"meta:altId": "_{TENANT_ID}.datatypes.8779fd45d6e4eb074300023a439862bbba359b60d451627a",
"meta:resourceType": "datatypes",
"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
スキーマレジストリからデータ型を削除する必要が生じる場合があります。 これは、パスで指定されたDELETEタイプ ID を使用してデータリクエストを実行することでおこなわれます。
API 形式
DELETE /tenant/datatypes/{DATA_TYPE_ID}
{DATA_TYPE_ID}
$id
URI or meta:altId
の値を指定します。リクエスト
curl -X DELETE \
https://platform.adobe.io/data/foundation/schemaregistry/tenant/datatypes/_{TENANT_ID}.datatypes.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(Not Found) を受け取る必要があります。