Popular:
CSM-CRMC-06
Opzioni di configurazione.
La funzionalità permette di ricevere l’elenco delle opzioni di configurazione disponibili per un prodotto. Da utilizzare per popolare correttamente le opzioni in creazione di una Variante.
Questa API richiede l’immissione di un Token autorizzativo valido e il possesso del permesso MNRM per garantire la sicurezza dei dati.
Richiesta
PARAMETRI OBBLIGATORI:
customerId: ID del Customer attivo
configuratorRawMaterialId: ID del prodotto padre (nel caso di varianti)
ALTRI PARAMETRI:
HEADER
[GET] /api-catalog/v2
/customers/{customerId:long}
/products/{configuratorRawMaterialId:long}
/configurations
Risposta
Elenco delle opzioni di configurazione disponibili per il prodotto. Il primo livello rappresenta il sottomodello, in prodotti complessi potrebbero essercene più di uno. Gli attributi rappresentano un tipo di configurazione, mentre le opzioni sono tutti i valori ammessi per quel tipo.
RESPONSE-DTO
In caso di errore o risultato senza ritorno.
[200] OK
[
{
"modelTypeId": 0,
"modelTypeName": "string",
"attributes": [
{
"attributeId": 0,
"title": "string",
"options": [
{
"valueId": 0,
"name": "string"
}
]
}
]
}
]
[400] Bad Request
[401] Unauthorized
Esempio
using RestSharp;
using System.Collections.Generic;
using System.Threading.Tasks;
public async Task> GetConfigurationsAsync(long customerId, long configuratorRawMaterialId, string token)
{
var client = new RestClient("https://apim-fe-staging.tailoor.com");
var request = new RestRequest($"/api-catalog/v2/customers/{customerId}/products/{configuratorRawMaterialId}/configurations", Method.Get);
// Aggiunge il Bearer Token agli header
request.AddHeader("Authorization", $"Bearer {token}");
// Effettua la richiesta e ottiene la risposta
var response = await client.ExecuteAsync>(request);
// Gestione delle risposte di errore
if (!response.IsSuccessful)
{
throw new Exception($"Errore nella richiesta: {response.StatusCode} - {response.Content}");
}
return response.Data;
}
public class ApiResponseDto
{
public int ModelTypeId { get; set; }
public string ModelTypeName { get; set; }
public List Attributes { get; set; }
}
public class AttributeDto
{
public int AttributeId { get; set; }
public string Title { get; set; }
public List Options { get; set; }
}
public class OptionDto
{
public int ValueId { get; set; }
public string Name { get; set; }
}
Per ulteriori dettagli consultare Api.Web.Catalog

