計算済み属性機能は現在アルファ版で、すべてのユーザーが使用できるわけではありません。 ドキュメントと機能は変更される場合があります。
計算済み属性を設定するには、まず、計算済み属性値を保持するフィールドを特定する必要があります。このフィールドは、スキーマレジストリ API を使用して作成し、計算済み属性フィールドを保持するスキーマとカスタムスキーマフィールドグループを定義できます。 別の「計算済み属性」スキーマとフィールドグループを作成し、組織が計算済み属性として使用する属性を追加できることをお勧めします。 これにより、計算済み属性スキーマを、データ取得に使用されている他のスキーマから明確に分離できます。
このドキュメントのワークフローでは、スキーマレジストリ API を使用して、カスタムフィールドグループを参照する、プロファイルが有効な「計算済み属性」スキーマを作成する方法について説明します。 このドキュメントには、計算済み属性に固有のサンプルコードが含まれていますが、 スキーマレジストリ API ガイド を参照してください。
スキーマレジストリ API を使用してフィールドグループを作成するには、まず /tenant/fieldgroups
エンドポイントを作成し、リクエスト本文にフィールドグループの詳細を指定します。 スキーマレジストリ API を使用したフィールドグループの操作に関する詳細は、 フィールドグループ API エンドポイントガイド.
API 形式
POST /tenant/fieldgroups
リクエスト
curl -X POST \
https://platform.adobe.io/data/foundation/schemaregistry/tenant/fieldgroups\
-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 '{
"title":"Computed Attributes Field Group",
"description":"Description of the field group.",
"type":"object",
"meta:extensible": true,
"meta:abstract": true,
"meta:intendedToExtend": [
"https://ns.adobe.com/xdm/context/profile"
],
"definitions": {
"computedAttributesFieldGroup": {
"type": "object",
"meta:xdmType": "object",
"properties": {
"_{TENANT_ID}": {
"type": "object",
"meta:xdmType": "object",
"properties": {
"birthdayCurrentMonth": {
"type": "boolean",
"meta:xdmType": "boolean"
}
}
}
}
}
},
"allOf": [
{
"$ref": "#/definitions/computedAttributesFieldGroup"
}
]
}'
プロパティ | 説明 |
---|---|
title |
作成するフィールドグループの名前。 |
meta:intendedToExtend |
フィールドグループを使用できる XDM クラス。 |
応答
リクエストが成功すると、HTTP 応答ステータス 201(作成済み)が返され、応答本文に、新しく作成されたフィールドグループの詳細 ( $id
, meta:altIt
、および version
. これらの値は読み取り専用で、スキーマレジストリによって割り当てられます。
{
"$id": "https://ns.adobe.com/{TENANT_ID}/mixins/860ad1b1b35e0a88ecf6df92ebce08335c180313d5805352",
"meta:altId": "_{TENANT_ID}.mixins.860ad1b1b35e0a88ecf6df92ebce08335c180313d5805352",
"meta:resourceType": "mixins",
"version": "1.0",
"title": "Computed Attributes Field Group",
"type": "object",
"description": "Description of the field group.",
"definitions": {
"computedAttributesFieldGroup": {
"type": "object",
"meta:xdmType": "object",
"properties": {
"_{TENANT_ID}": {
"type": "object",
"meta:xdmType": "object",
"properties": {
"birthdayCurrentMonth": {
"type": "boolean",
"meta:xdmType": "boolean"
}
}
}
}
}
},
"allOf": [
{
"$ref": "#/definitions/computedAttributesFieldGroup",
"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": 1612861108205,
"repo:lastModifiedDate": 1612861108205,
"xdm:createdClientId": "{CLIENT_ID}",
"xdm:lastModifiedClientId": "{CLIENT_ID}",
"xdm:createdUserId": "{USER_ID}",
"xdm:lastModifiedUserId": "{USER_ID}",
"eTag": "627faa3346d3004aef2010e9bd2b7e721b19ae7857b276f3ef733e6e732d495f",
"meta:globalLibVersion": "1.19.4"
},
"meta:containerId": "tenant",
"meta:sandboxId": "{SANDBOX_ID}",
"meta:sandboxType": "production",
"meta:tenantNamespace": "_{TENANT_ID}"
}
追加の計算済み属性が必要な場合は、に対してPUTリクエストを実行することで、計算済み属性フィールドグループを追加の属性で更新できます /tenant/fieldgroups
endpoint. このリクエストでは、パスで作成したフィールドグループの一意の ID と、本文に追加するすべての新しいフィールドを含める必要があります。
スキーマレジストリ API を使用したフィールドグループの更新について詳しくは、 フィールドグループ API エンドポイントガイド.
API 形式
PUT /tenant/fieldgroups/{FIELD_GROUP_ID}
リクエスト
このリクエストでは、 purchaseSummary
情報。
PUTリクエストを通じてフィールドグループを更新する場合、本文には、POSTリクエストで新しいフィールドグループを作成する際に必要となるすべてのフィールドを含める必要があります。
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 '{
"type": "object",
"title": "Computed Attributes Field Group",
"meta:extensible": true,
"meta:abstract": true,
"meta:intendedToExtend": [
"https://ns.adobe.com/xdm/context/profile"
],
"description": "Description of field group.",
"definitions": {
"computedAttributesFieldGroup": {
"type": "object",
"meta:xdmType": "object",
"properties": {
"_{TENANT_ID}": {
"type": "object",
"meta:xdmType": "object",
"properties": {
"birthdayCurrentMonth": {
"type": "boolean",
"meta:xdmType": "boolean"
},
"purchaseSummary": {
"type": "object",
"meta:xdmType": "object",
"properties": {
"totalSpend": {
"type": "number",
"meta:xdmType": "number"
},
"countPurchases": {
"meta:xdmType": "int",
"type": "integer",
"minimum": -2147483648,
"maximum": 2147483647
},
"averageSpend": {
"type": "number",
"meta:xdmType": "number"
}
}
}
}
}
}
}
},
"allOf": [
{
"$ref": "#/definitions/computedAttributesFieldGroup"
}
]
}'
応答
正常な応答は、更新されたフィールドグループの詳細を返します。
{
"$id": "https://ns.adobe.com/{TENANT_ID}/mixins/860ad1b1b35e0a88ecf6df92ebce08335c180313d5805352",
"meta:altId": "_{TENANT_ID}.mixins.860ad1b1b35e0a88ecf6df92ebce08335c180313d5805352",
"meta:resourceType": "mixins",
"version": "1.0",
"title": "Computed Attributes Field Group",
"type": "object",
"description": "Description of field group.",
"definitions": {
"computedAttributesFieldGroup": {
"type": "object",
"meta:xdmType": "object",
"properties": {
"_{TENANT_ID}": {
"type": "object",
"meta:xdmType": "object",
"properties": {
"birthdayCurrentMonth": {
"type": "boolean",
"meta:xdmType": "boolean"
},
"purchaseSummary": {
"type": "object",
"meta:xdmType": "object",
"properties": {
"totalSpend": {
"type": "number",
"meta:xdmType": "number"
},
"countPurchases": {
"meta:xdmType": "int",
"type": "integer",
"minimum": -2147483648,
"maximum": 2147483647
},
"averageSpend": {
"type": "number",
"meta:xdmType": "number"
}
}
}
}
}
}
}
},
"allOf": [
{
"$ref": "#/definitions/computedAttributesFieldGroup",
"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": 1612861108205,
"repo:lastModifiedDate": 1612861108205,
"xdm:createdClientId": "{CLIENT_ID}",
"xdm:lastModifiedClientId": "{CLIENT_ID}",
"xdm:createdUserId": "{USER_ID}",
"xdm:lastModifiedUserId": "{USER_ID}",
"eTag": "627faa3346d3004aef2010e9bd2b7e721b19ae7857b276f3ef733e6e732d495f",
"meta:globalLibVersion": "1.19.4"
},
"meta:containerId": "tenant",
"meta:sandboxId": "{SANDBOX_ID}",
"meta:sandboxType": "production",
"meta:tenantNamespace": "_{TENANT_ID}"
}
スキーマレジストリ API を使用してスキーマを作成するには、まず /tenant/schemas
エンドポイントを作成し、リクエスト本文にスキーマの詳細を指定します。 スキーマを有効にする必要もあります。 Profile とは、スキーマクラスの和集合スキーマの一部として表示されます。
詳しくは、 Profile — 有効なスキーマと和集合スキーマです。確認してください Schema Registry API ガイド そして スキーマ構成の基本ドキュメント.
API 形式
POST /tenants/schemas
リクエスト
follow リクエストは、 computedAttributesFieldGroup
は、このドキュメントで既に作成されており(一意の ID を使用)、( meta:immutableTags
配列 ) を参照してください。 スキーマレジストリ API を使用してスキーマを作成する方法について詳しくは、 schemas API エンドポイントガイド.
curl -X POST \
https://platform.adobe.io/data/foundation/schemaregistry/tenant/schemas \
-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 '{
"type": "object",
"title": "Computed Attributes Schema",
"meta:extensible": false,
"meta:abstract": false,
"meta:immutableTags": [
"union"
],
"meta:extends": [
"https://ns.adobe.com/xdm/context/profile",
"https://ns.adobe.com/xdm/context/identitymap",
"https://ns.adobe.com/{TENANT_ID}/mixins/860ad1b1b35e0a88ecf6df92ebce08335c180313d5805352"
],
"description": "Description of schema.",
"definitions": {
},
"allOf": [
{
"$ref": "https://ns.adobe.com/xdm/context/profile"
},
{
"$ref": "https://ns.adobe.com/xdm/context/identitymap"
},
{
"$ref": "https://ns.adobe.com/{TENANT_ID}/mixins/860ad1b1b35e0a88ecf6df92ebce08335c180313d5805352"
}
],
"meta:class": "https://ns.adobe.com/xdm/context/profile"
}'
応答
正常な応答は、HTTP ステータス 201(作成済み)と、新しく作成されたスキーマの詳細($id
、meta:altId
、version
など)を含むペイロードを返します。これらの値は読み取り専用で、スキーマレジストリによって割り当てられます。
{
"$id": "https://ns.adobe.com/{TENANT_ID}/schemas/699c1f16821c51086394fef8233d7fdb61e6f5b574b5a230",
"meta:altId": "_{TENANT}.schemas.699c1f16821c51086394fef8233d7fdb61e6f5b574b5a230",
"meta:resourceType": "schemas",
"version": "1.0",
"title": "Computed Attributes Schema",
"type": "object",
"description": "Description of schema.",
"definitions": {},
"allOf": [
{
"$ref": "https://ns.adobe.com/xdm/context/profile",
"type": "object",
"meta:xdmType": "object"
},
{
"$ref": "https://ns.adobe.com/xdm/context/identitymap",
"type": "object",
"meta:xdmType": "object"
},
{
"$ref": "https://ns.adobe.com/{TENANT_ID}/mixins/860ad1b1b35e0a88ecf6df92ebce08335c180313d5805352",
"type": "object",
"meta:xdmType": "object"
}
],
"refs": [
"https://ns.adobe.com/xdm/context/profile",
"https://ns.adobe.com/xdm/context/identitymap",
"https://ns.adobe.com/{TENANT_ID}/mixins/860ad1b1b35e0a88ecf6df92ebce08335c180313d5805352"
],
"imsOrg": "{ORG_ID}",
"meta:extensible": false,
"meta:abstract": false,
"meta:extends": [
"https://ns.adobe.com/xdm/common/auditable",
"https://ns.adobe.com/xdm/data/record",
"https://ns.adobe.com/xdm/context/profile",
"https://ns.adobe.com/xdm/context/identitymap",
"https://ns.adobe.com/{TENANT_ID}/mixins/860ad1b1b35e0a88ecf6df92ebce08335c180313d5805352"
],
"meta:xdmType": "object",
"meta:registryMetadata": {
"repo:createdDate": 1612385766411,
"repo:lastModifiedDate": 1612385766411,
"xdm:createdClientId": "{CLIENT_ID}",
"xdm:lastModifiedClientId": "{CLIENT_ID}",
"xdm:createdUserId": "{USER_ID}",
"xdm:lastModifiedUserId": "{USER_ID}",
"eTag": "a9c6b5c25c109970ffa5eaeb3db2b47b59c696e1d9407fb39ccf7e48b74b558e",
"meta:globalLibVersion": "1.18.4"
},
"meta:class": "https://ns.adobe.com/xdm/context/profile",
"meta:containerId": "tenant",
"meta:sandboxId": "{SANDBOX_ID}",
"meta:sandboxType": "production",
"meta:tenantNamespace": "_{TENANT}",
"meta:immutableTags": [
"union"
]
}
計算済み属性の保存先となるスキーマおよびフィールドグループを作成したので、 /computedattributes
API エンドポイント。 API で計算済み属性を作成する詳細な手順については、 計算済み属性 API エンドポイントガイド.