Endpoint "mixins" (obsoleto)
Creato per:
- Sviluppatore
/mixins
è stato dichiarato obsoleto a favore dell'endpoint /fieldgroups
./mixins
continuerà a essere mantenuto come endpoint legacy, si consiglia vivamente di utilizzare /fieldgroups
per le nuove implementazioni dell'API Schema Registry nelle applicazioni Experience. Per ulteriori informazioni, consulta la guida dell'endpoint dei gruppi di campi.I mixin sono componenti riutilizzabili che definiscono uno o più campi che rappresentano un concetto particolare, ad esempio una singola persona, un indirizzo postale o un ambiente di browser web. I mixin sono destinati a essere inclusi come parte di uno schema che implementa una classe compatibile, a seconda del comportamento dei dati che rappresentano (record o serie temporali). L'endpoint /mixins
nell'API Schema Registry consente di gestire in modo programmatico i mixin all'interno dell'applicazione Experience.
Introduzione
L'endpoint utilizzato in questa guida fa parte dell'Schema Registry API. Prima di continuare, consulta la guida introduttiva per i collegamenti alla documentazione correlata, una guida alla lettura delle chiamate API di esempio in questo documento e per le informazioni importanti sulle intestazioni necessarie per effettuare correttamente le chiamate a qualsiasi API di Experience Platform.
Recuperare un elenco di mixin
È possibile elencare tutti i mixin nel contenitore global
o tenant
effettuando una richiesta GET rispettivamente a /global/mixins
o /tenant/mixins
.
Formato API
GET /{CONTAINER_ID}/mixins?{QUERY_PARAMS}
{CONTAINER_ID}
global
per i mixin creati dall'Adobe o tenant
per i mixin di proprietà dell'organizzazione.{QUERY_PARAMS}
Richiesta
La richiesta seguente recupera un elenco di mixin dal contenitore tenant
, utilizzando un parametro di query orderby
per ordinare i mixin in base al loro attributo 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: {ORG_ID}' \
-H 'x-sandbox-name: {SANDBOX_NAME}'
Il formato della risposta dipende dall'intestazione Accept
inviata nella richiesta. Le seguenti intestazioni Accept
sono disponibili per l'elenco dei mixin:
Accept
application/vnd.adobe.xed-id+json
application/vnd.adobe.xed+json
$ref
e allOf
originali. (Limite: 300)Risposta
La richiesta precedente ha utilizzato l'intestazione application/vnd.adobe.xed-id+json
Accept
, pertanto la risposta include solo gli attributi title
, $id
, meta:altId
e version
per ciascun mixin. L'utilizzo dell'altra intestazione Accept
(application/vnd.adobe.xed+json
) restituisce tutti gli attributi di ciascun mixin. Selezionare l'intestazione Accept
appropriata in base alle informazioni richieste nella risposta.
{
"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"
}
}
}
Cercare un mixin
Per cercare un mixin specifico, devi includere l’ID del mixin nel percorso di una richiesta GET.
Formato API
GET /{CONTAINER_ID}/mixins/{MIXIN_ID}
{CONTAINER_ID}
global
per un mixin creato da un Adobe o tenant
per un mixin di proprietà della tua organizzazione.{MIXIN_ID}
meta:altId
o $id
con codifica URL del mixin che desideri cercare.Richiesta
La richiesta seguente recupera un mixin in base al valore meta:altId
fornito nel percorso.
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: {ORG_ID}' \
-H 'x-sandbox-name: {SANDBOX_NAME}'
Il formato della risposta dipende dall'intestazione Accept
inviata nella richiesta. Tutte le richieste di ricerca richiedono l'inclusione di version
nell'intestazione Accept
. Sono disponibili le seguenti Accept
intestazioni:
Accept
application/vnd.adobe.xed+json; version=1
$ref
e allOf
, con titoli e descrizioni.application/vnd.adobe.xed-full+json; version=1
$ref
e allOf
risolti, con titoli e descrizioni.application/vnd.adobe.xed-notext+json; version=1
$ref
e allOf
, nessun titolo o descrizione.application/vnd.adobe.xed-full-notext+json; version=1
$ref
e allOf
risolti, nessun titolo o descrizione.application/vnd.adobe.xed-full-desc+json; version=1
$ref
e allOf
risolti, descrittori inclusi.Risposta
In caso di esito positivo, la risposta restituisce i dettagli del mixin. I campi restituiti dipendono dall'intestazione Accept
inviata nella richiesta. Prova a confrontare le risposte con intestazioni Accept
diverse e a determinare quale sia il migliore per il tuo caso d'uso.
{
"$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}"
}
Creare un mixin
È possibile definire un mixin personalizzato sotto il contenitore tenant
effettuando una richiesta POST.
Formato API
POST /tenant/mixins
Richiesta
Quando si definisce un nuovo mixin, deve includere un attributo meta:intendedToExtend
, elencando $id
delle classi con cui il mixin è compatibile. In questo esempio, il mixin è compatibile con una classe Property
definita in precedenza. I campi personalizzati devono essere nidificati in _{TENANT_ID}
(come mostrato nell'esempio) per evitare conflitti con campi simili forniti da classi e altri mixin.
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: {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"
}
]
}'
Risposta
In caso di esito positivo, la risposta restituisce lo stato HTTP 201 (Creato) e un payload contenente i dettagli del mixin appena creato, inclusi $id
, meta:altId
e version
. Questi valori sono di sola lettura e sono assegnati da 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}"
}
L'esecuzione di una richiesta di GET per elencare tutti i mixin nel contenitore tenant includerebbe ora il mixin Dettagli proprietà, oppure è possibile eseguire una richiesta di ricerca (GET) utilizzando l'URI $id
codificato dall'URL per visualizzare direttamente il nuovo mixin.
Aggiornare un mixin
Puoi sostituire un intero mixin con un’operazione PUT, essenzialmente riscrivendo la risorsa. Quando si aggiorna un mixin tramite una richiesta PUT, il corpo deve includere tutti i campi necessari per creare un nuovo mixin in una richiesta POST.
Formato API
PUT /tenant/mixins/{MIXIN_ID}
{MIXIN_ID}
meta:altId
o $id
con codifica URL del mixin che desideri riscrivere.Richiesta
La richiesta seguente riscrive un mixin esistente, aggiungendo un nuovo campo 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: {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"
}
]
}'
Risposta
In caso di esito positivo, la risposta restituisce i dettagli del mixin aggiornato.
{
"$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}"
}
Aggiornare una parte di un mixin
Puoi aggiornare una parte di un mixin utilizzando una richiesta PATCH. Schema Registry supporta tutte le operazioni Patch JSON standard, inclusi add
, remove
e replace
. Per ulteriori informazioni sulla patch JSON, consulta la guida delle API fondamentali.
Formato API
PATCH /tenant/mixin/{MIXIN_ID}
{MIXIN_ID}
$id
con codifica URL o meta:altId
del mixin da aggiornare.Richiesta
La richiesta di esempio seguente aggiorna il description
di un mixin esistente e aggiunge un nuovo campo propertyCity
.
Il corpo della richiesta è un array e ogni oggetto elencato rappresenta una modifica specifica di un singolo campo. Ogni oggetto include l'operazione da eseguire (op
), il campo in cui deve essere eseguita l'operazione (path
) e le informazioni da includere nell'operazione (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: {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"
}
}
]'
Risposta
La risposta mostra che entrambe le operazioni sono state eseguite correttamente. description
è stato aggiornato e propertyCountry
aggiunto in 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}"
}
Eliminare un mixin
Talvolta può essere necessario rimuovere un mixin dal registro degli schemi. Questa operazione viene eseguita eseguendo una richiesta DELETE con l’ID mixin fornito nel percorso.
Formato API
DELETE /tenant/mixins/{MIXIN_ID}
{MIXIN_ID}
$id
con codifica URL o meta:altId
del mixin da eliminare.Richiesta
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: {ORG_ID}' \
-H 'x-sandbox-name: {SANDBOX_NAME}'
Risposta
In caso di esito positivo, la risposta restituisce lo stato HTTP 204 (nessun contenuto) e un corpo vuoto.
È possibile confermare l'eliminazione tentando una richiesta di ricerca (GET) nel mixin. È necessario includere un'intestazione Accept
nella richiesta, ma dovrebbe ricevere lo stato HTTP 404 (Non trovato) perché il mixin è stato rimosso dal registro degli schemi.