CSM-CRM-02

Dettaglio di un Prodotto.
Il recupero delle informazioni di un prodotto non si limita ai dati di base, ma include dettagli provenienti da altre aree dell’API. Questo processo genera un JSON di medie dimensioni, contenente una vasta gamma di informazioni.
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

PARAMETRI OPZIONALI:
allDetails: default false, se impostato a true vengono ritornati tutti i dettagli del Prodotto, altrimenti solo l’anagrafica base

ALTRI PARAMETRI:
HEADER

				
					[GET] /api-catalog/v2
/customers/{customerId:long}
/products/{configuratorRawMaterialId:long}
?allDetails=false
				
			

Risposta

Informazioni di dettaglio del Prodotto

RESPONSE-DTO
In caso di errore o risultato senza ritorno.

				
					[200] OK
{
  "id": 0,
  "parentProductId": 0,
  "sku": "string",
  "rawMaterialId": 0,
  "modelTypeId": 0,
  "isActive": true,
  "warehouseQuantity": 0,
  "images": [
    {
      "id": 0,
      "imageType": 0,
      "url": "string"
    }
  ],
  "relatedProducts": [
    {
      "relatedProductId": 0,
      "relationType": 1000,
      "isActive": true
    }
  ],
  "attributes": [
    {}
  ],
  "configurations": [
    {
      "tagId": 0,
      "tagName": "string",
      "steps": [
        {
          "modelTypeId": 0,
          "modelTypeName": "string",
          "attributes": [
            {
              "attributeId": 0,
              "title": "string",
              "options": [
                {
                  "valueId": 0,
                  "name": "string",
                  "isSelected": true
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}

[400] Bad Request

[401] Unauthorized
				
			

Esempio

				
					using RestSharp;
using System.Threading.Tasks;

public async Task<ProductResponseDto> GetProductAsync(long customerId, long configuratorRawMaterialId, string bearerToken)
{
    var client = new RestClient("https://apim-fe-staging.tailoor.com");
    var request = new RestRequest($"/api-catalog/v2/customers/{customerId}/products/{configuratorRawMaterialId}", Method.Get);
    
    // Aggiungi il Bearer Token nell'header
    request.AddHeader("Authorization", $"Bearer {bearerToken}");

    var response = await client.ExecuteAsync<ProductResponseDto>(request);

    if (response.IsSuccessful)
    {
        return response.Data; // Restituisce i dati mappati nel DTO
    }
    
    // Gestione degli errori
    throw new Exception($"Error: {response.StatusCode}, {response.Content}");
}

public class ProductResponseDto
{
    public long Id { get; set; }
    public long ParentProductId { get; set; }
    public string Sku { get; set; }
    public long RawMaterialId { get; set; }
    public long ModelTypeId { get; set; }
    public bool IsActive { get; set; }
    public int WarehouseQuantity { get; set; }
    public List<ImageDto> Images { get; set; }
    public List<RelatedProductDto> RelatedProducts { get; set; }
    public List<AttributeDto> Attributes { get; set; }
    public List<ConfigurationDto> Configurations { get; set; }
}

public class ImageDto
{
    public long Id { get; set; }
    public int ImageType { get; set; }
    public string Url { get; set; }
}

public class RelatedProductDto
{
    public long RelatedProductId { get; set; }
    public int RelationType { get; set; }
    public bool IsActive { get; set; }
}

public class AttributeDto
{
    // Definisci i campi in base alla risposta effettiva
}

public class ConfigurationDto
{
    public long TagId { get; set; }
    public string TagName { get; set; }
    public List<ConfigurationDetailDto> Steps { get; set; }
}

public class ConfigurationDetailDto
{
    public long ModelTypeId { get; set; }
    public string ModelTypeName { get; set; }
    public List<ConfigurationAttributeDto> Attributes { get; set; }
}

public class ConfigurationAttributeDto
{
    public long AttributeId { get; set; }
    public string AttributeName { get; set; }
    public List<ConfigurationOptionDto> Options { get; set; }
}

public class ConfigurationOptionDto
{
    public long ValueId { get; set; }
    public string? Name { get; set; }
    public bool IsSelected { get; set; }
}


				
			

Per ulteriori dettagli consultare Api.Web.Catalog