> For the complete documentation index, see [llms.txt](https://help.citrusad.com/retail-media-interface/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.citrusad.com/retail-media-interface/partner/it/partner-api-overview/error-handling.md).

# Gestione degli errori

Epsilon Retail Media Le API dei partner seguono un approccio strutturato e coerente per la gestione degli errori. Ciò garantisce che le risposte di errore siano prevedibili, facili da analizzare e utili per il debug.

## Struttura della risposta di errore

Quando si verifica un errore, l'API restituisce:

* Un codice di stato HTTP standard.
* Un corpo JSON strutturato con i campi code, message e details opzionale.
* Un elenco di violazioni a livello di campo (se applicabile), che consente ai client di correggere più problemi in una sola volta.

## Strategie di base per la gestione degli errori

Quando si riscontra un errore, seguire questi passaggi:

1. **Leggere attentamente il messaggio di errore** - La risposta di errore fornisce informazioni specifiche su cosa è andato storto e su quale campo ha causato il problema.
2. **Rivedere la pagina dell'endpoint** - Se non si è sicuri di come procedere, rivedere la pagina specifica per l'endpoint che si sta utilizzando.
3. **Contattare l'assistenza** - Se si continuano a riscontrare problemi, è possibile aprire una segnalazione nel nostro Portale di assistenza. Si prega di fornire:
   * La chiamata API esatta che si sta effettuando.
   * Il retailer e il team specifici.
   * L'entità specifica che si sta creando/aggiornando.
   * La risposta di errore completa visualizzata.

Queste informazioni garantiranno che il nostro team possa assistervi in modo efficiente ed efficace.

### Esempio di singola violazione

```json
{
  "code": 3,
  "message": "Invalid argument(s) for product campaign creation",
  "details": [
    {
      "@type": "type.googleapis.com/google.rpc.BadRequest",
      "fieldViolations": [
        {
          "field": "maxBid",
          "description": "[maxBid] must be greater or equal [minBid]"
        }
      ]
    }
  ]
}
```

### Esempio di violazioni multiple

```json
{
  "code": 3,
  "message": "Invalid argument(s) for product campaign update",
  "details": [
    {
      "@type": "type.googleapis.com/google.rpc.BadRequest",
      "fieldViolations": [
        {
          "field": "strategy.fixedTenancy.catalogCosts",
          "description": "all catalog cost percentages for fixed tenancy must sum to 100%"
        },
        {
          "field": "strategy.fixedTenancy.catalogCosts",
          "description": "fixed tenancy catalog cost [...] is duplicated in the list"
        }
      ]
    }
  ]
}
```

## Codici di stato HTTP standard

| Codice di stato HTTP      | Significato                                      | Quando si verifica                                             |
| ------------------------- | ------------------------------------------------ | -------------------------------------------------------------- |
| 200 OK                    | Richiesta riuscita                               | Chiamata API riuscita                                          |
| 204 No Content            | Operazione riuscita, nessun corpo della risposta | Richiesta riuscita senza payload di ritorno                    |
| 400 Bad Request           | Input non valido                                 | Richiesta non formattata correttamente o errore di validazione |
| 401 Unauthorized          | Token mancante o non valido                      | Token non fornito o scaduto                                    |
| 403 Forbidden             | Accesso negato                                   | Token valido ma privo di autorizzazione                        |
| 404 Not Found             | Risorsa non trovata                              | Endpoint o ID risorsa non valido                               |
| 409 Conflict              | Dati duplicati o in conflitto                    | La risorsa esiste già o viola i vincoli                        |
| 429 Too Many Requests     | Limite di frequenza superato                     | Troppe richieste in un breve periodo di tempo                  |
| 500 Internal Server Error | Problema lato server                             | Errore imprevisto sul server                                   |
| 503 Service Unavailable   | Interruzione temporanea                          | Il servizio è inattivo o in manutenzione                       |

## Mappatura dei codici di errore da gRPC a HTTP

| Codice gRPC | Nome gRPC            | Codice HTTP | Nome HTTP             |
| ----------- | -------------------- | ----------- | --------------------- |
| 0           | OK                   | 200         | OK                    |
| 1           | CANCELLED            | 499         | Client Closed Request |
| 2           | UNKNOWN              | 500         | Internal Server Error |
| 3           | INVALID\_ARGUMENT    | 400         | Bad Request           |
| 4           | DEADLINE\_EXCEEDED   | 504         | Gateway Timeout       |
| 5           | NOT\_FOUND           | 404         | Not Found             |
| 6           | ALREADY\_EXISTS      | 409         | Conflict              |
| 7           | PERMISSION\_DENIED   | 403         | Forbidden             |
| 8           | RESOURCE\_EXHAUSTED  | 429         | Too Many Requests     |
| 9           | FAILED\_PRECONDITION | 400         | Bad Request           |
| 10          | ABORTED              | 409         | Conflict              |
| 11          | OUT\_OF\_RANGE       | 400         | Bad Request           |
| 12          | UNIMPLEMENTED        | 501         | Not Implemented       |
| 13          | INTERNAL             | 500         | Internal Server Error |
| 14          | UNAVAILABLE          | 503         | Service Unavailable   |
| 15          | DATA\_LOSS           | 500         | Internal Server Error |
| 16          | UNAUTHENTICATED      | 401         | Unauthorized          |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://help.citrusad.com/retail-media-interface/partner/it/partner-api-overview/error-handling.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
