Messaggi di errore API
Quando una richiesta API non riesce a causa di errori di richiesta o errori del server, viene restituito un messaggio di risposta di errore in formato JSON.
Un messaggio di risposta di errore viene restituito in formato JSON anche per endpoint che supportano altri tipi MIME. Il messaggio di risposta di errore include il messaggio di errore stesso, una descrizione dell'errore, un codice di errore univoco per l'endpoint, un messaggio di risposta HTTP e un codice di risposta HTTP.
La risposta di errore comprende i seguenti campi:
- message: il messaggio di errore
- details: un campo per ulteriori informazioni, che può essere popolato o meno
- description: descrizione dell'errore specifico
- code: codice di risposta di errore univoco
- http_response:
- message: messaggio di risposta HTTP
- code: codice di stato della risposta HTTP
Ad esempio, la seguente richiesta API tenta di ottenere informazioni su una serie di riferimento non esistente denominata "test-set":
https://<host_ip>/api/reference_data/sets/test_set
Un HTTP404Vengono restituiti il codice di risposta e il seguente messaggio di risposta di errore JSON:
{
"message": "test_set does not exist",
"details": {},
"description": "The reference set does not exist.",
"code": 1002,
"http_response": {
"message": "We could not find the resource you requested.",
"code": 404
}
}
La seguente tabella fornisce ulteriori informazioni sulle categorie di errore di risposta HTTP restituite dall'API REST IBM® QRadar® :
Categoria di errore HTTP | Codice di risposta HTTP | Messaggio di risposta HTTP |
---|---|---|
Multiple Choices | 300 | The requested resource corresponds to any one of a set of representations, each with its own specific location. |
Moved Permanently | 301 | The resource has moved permanently. Please refer to the documentation. |
Trovato | 302 | The resource has moved temporarily. Please refer to the documentation. |
Vedi altro | 303 | The resource can be found under a different URI. |
Not Modified | 304 | The resource is available and not modified. |
Utilizza proxy | 305 | The requested resource must be accessed through the proxy given by the Location field. |
Reindirizzamento temporaneo | 307 | The resource resides temporarily under a different URI. |
Richiesta non valida | 400 | Invalid syntax for this request was provided. |
Non autorizzato | 401 | You are unauthorized to access the requested resource. Please log in. |
Accesso negato | 403 | Your account is not authorized to access the requested resource. |
NON TROVATO | 404 | We could not find the resource you requested. Please refer to the documentation for the list of resources. |
Method Not Allowed | 405 | This method type is not currently supported. |
Non accettabile | 406 | Acceptance header is invalid for this endpoint resource. |
Proxy Authentication Required | 407 | Authentication with proxy is required. |
Request Timeout | 408 | Client did not produce a request within the time that the server was prepared to wait. |
Conflict | 409 | The request could not be completed due to a conflict with the current state of the resource. |
Gone | 410 | The requested resource is no longer available and has been permanently removed. |
Lunghezza richiesta | 411 | Length of the content is required, please include it with the request. |
Precondizione non riuscita | 412 | The request did not match the pre-conditions of the requested resource. |
Request Entity Too Large | 413 | The request entity is larger than the server is willing or able to process. |
URI-richiesta troppo lungo | 414 | The request URI is longer than the server is willing to interpret. |
Tipo di supporto non supportato | 415 | The requested resource does not support the media type provided. |
Intervallo richiesto non soddisfabile | 416 | The requested range for the resource is not available. |
Expectation Failed | 417 | Unable to meet the expectation given in the Expect request header. |
ARGOMENTI MANCANTI | 419 | The requested resource is missing required arguments. |
ARGOMENTI NON VALIDI | 420 | The requested resource does not support one or more of the given parameters. |
Entità non elaborabile | 422 | The request was well-formed but was unable to be followed due to semantic errors. |
Errore interno del server | 500 | Unexpected internal server error. |
Not Implemented | 501 | The requested resource is recognized but not implemented. |
Bad Gateway | 502 | Invalid response received when acting as a proxy or gateway. |
Service Unavailable | 503 | The server is currently unavailable. |
Gateway Timeout | 504 | Did not receive a timely response from upstream server while acting as a gateway or proxy. |
Versione HTTP non supportata | 505 | The HTTP protocol version used in the request message is not supported. |
ERRORE DI INIZIALIZZAZIONE | 550 | A failure occurred during initialization of services. API will be unavailable. |