Ottieni attributi (.NET)
Descrizione
GetAttributes() viene utilizzato per recuperare esperienze di sperimentazione e personalizzate da Target ed estrarre i valori degli attributi.
Metodo
getAttributes
TargetAttributes TargetClient.GetAttributes(TargetDeliveryRequest targetRequest, params string[] mboxes)
Parametri
Nome
Tipo
Obbligatorio
Predefinito
Descrizione
targetRequest
TargetDeliveryRequest
No
nulle
La stessa richiesta Target utilizzata per Ottieni offerte
mboxNames
stringa parametri[]
No
nulle
Matrice di parametri di nomi mbox
Risultato
Un oggetto TargetAttributes è stato restituito da TargetClient.GetAttributes() con le proprietà e i metodi seguenti:
Proprietà/Metodo
Tipo restituito
Descrizione
Risposta
TargetDeliveryResponse
Restituisce l'oggetto di risposta normalmente restituito da Get Offers
ToDictionary
IReadOnlyDictionary
Restituisce un dizionario di dizionari con coppie chiave-valore raggruppate per nomi mbox
ToMboxDictionary(mboxName)
IReadOnlyDictionary
Restituisce un dizionario con coppie di valori chiave per la mbox fornita
GetBoolean(mboxName, key, defaultValue)
booleano
Restituisce il valore per il nome mbox e la chiave attributo specificati
GetString(mboxName, key, defaultValue)
stringa
Restituisce il valore per il nome mbox e la chiave attributo specificati
GetInteger(mboxName, key, defaultValue)
int
Restituisce il valore per il nome mbox e la chiave attributo specificati
GetDouble(mboxName, key, defaultValue)
doppio
Restituisce il valore per il nome mbox e la chiave attributo specificati
GetValue(mboxName, key, defaultValue)
T
Restituisce il valore per il nome mbox e la chiave attributo specificati
Esempio
.NET
var targetClientConfig = new TargetClientConfig.Builder("acmeClient", "ABCDEF012345677890ABCDEF0@AdobeOrg")
.Build();
var targetClient = TargetClient.Create(targetClientConfig);
var mboxRequests = new List<MboxRequest> { new (index: 1, name: "a1-serverside-ab") };
var targetDeliveryRequest = new TargetDeliveryRequest.Builder()
.Build();
var offerAttributes = targetClient.GetAttributes(targetDeliveryRequest, "demo-engineering-flags");
//returns just the value of searchProviderId from the mbox offer
var searchProviderId = offerAttributes.GetString("demo-engineering-flags", "searchProviderId");
//returns a simple Dictionary representing the mbox offer
var engineeringFlags = offerAttributes.ToMboxDictionary("demo-engineering-flags");
// the value of engineeringFlags looks like this
// {
// "cdnHostname": "cdn.cloud.corp.net",
// "searchProviderId": 143,
// "hasLegacyAccess": false
// }
var assetUrl = $"http://{engineeringFlags["cdnHostname"]}/path/to/asset";
recommendation-more-help
6906415f-169c-422b-89d3-7118e147c4e3