API hata iletileri
Bir API isteği, istek hataları ya da sunucu hataları nedeniyle başarısız olduğunda, JSON biçiminde bir hata yanıtı iletisi döndürülür.
Diğer MIME tiplerini destekleyen uç noktalar için bile JSON biçiminde bir hata yanıtı iletisi döndürülür. Hata yanıtı iletisi, hata iletisini, hatanın açıklamasını, uç nokta için benzersiz bir hata kodu, bir HTTP yanıt iletisi ve bir HTTP yanıt kodu içerir.
Hata yanıtı aşağıdaki alanları içerir:
- message: hata iletisi
- details: ek bilgi için bir alan; doldurulabilir ya da doldurulmamış olabilir
- description: belirli bir hatanın açıklaması
- code: Benzersiz hata yanıt kodu
- http_response:
- message: HTTP yanıt iletisi
- code: HTTP yanıt durumu kodu
Örneğin, aşağıdaki API isteği, "test-set" adı verilen, var olmayan bir başvuru kümesine ilişkin bilgi alma girişiminde bulunur:
https://<host_ip>/api/reference_data/sets/test_set
HTTP404yanıt kodu ve aşağıdaki JSON hata yanıt iletisi döndürüldü:
{
"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
}
}
Aşağıdaki tabloda, IBM® QRadar ® REST API 'si tarafından döndürülen HTTP yanıt hata kategorilerine ilişkin daha fazla bilgi sağlanmaktadır:
| HTTP hata kategorisi | HTTP Yanıt Kodu | HTTP yanıt iletisi |
|---|---|---|
| ÇOKLU SEçENEK | 300 | The requested resource corresponds to any one of a set of representations, each with its own specific location. |
| KALıCı | 301 | The resource has moved permanently. Please refer to the documentation. |
| Bulundu | 302 | The resource has moved temporarily. Please refer to the documentation. |
| DIğER | 303 | The resource can be found under a different URI. |
| DEĞİŞMEZ | 304 | The resource is available and not modified. |
| Yetkili Sunucu Kullan | 305 | The requested resource must be accessed through the proxy given by the Location field. |
| GEçICI | 307 | The resource resides temporarily under a different URI. |
| Hatalı istek | 400 | Invalid syntax for this request was provided. |
| Yetkisiz | 401 | You are unauthorized to access the requested resource. Please log in. |
| Yasak | 403 | Your account is not authorized to access the requested resource. |
| Bulunamadı | 404 | We could not find the resource you requested. Please refer to the documentation for the list of resources. |
| YöNELIK | 405 | This method type is not currently supported. |
| KABUL EDILEMEZ | 406 | Acceptance header is invalid for this endpoint resource. |
| YETKILI SUNUCU KIMLIK DENETIMI GEREKLI | 407 | Authentication with proxy is required. |
| İSTEK ZAMAN | 408 | Client did not produce a request within the time that the server was prepared to wait. |
| Çakışma | 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. |
| GEREKLI UZUNLUK | 411 | Length of the content is required, please include it with the request. |
| ÖNKOşU | 412 | The request did not match the pre-conditions of the requested resource. |
| İSTEK KIMLIğI | 413 | The request entity is larger than the server is willing or able to process. |
| İSTEK-URI çOK UZUN | 414 | The request URI is longer than the server is willing to interpret. |
| DESTEKLENMEYEN ORTAM TIPI | 415 | The requested resource does not support the media type provided. |
| İSTENEN ARALıK UYGUN | 416 | The requested range for the resource is not available. |
| BEKLENTI BAŞARISIZ OLDU | 417 | Unable to meet the expectation given in the Expect request header. |
| EKSIK BAĞIMSIZ DEĞIŞKENLER | 419 | The requested resource is missing required arguments. |
| GEçERSIZ | 420 | The requested resource does not support one or more of the given parameters. |
| İşLEMSEL OLMAYAN VAR | 422 | The request was well-formed but was unable to be followed due to semantic errors. |
| İç sunucu hatası | 500 | Unexpected internal server error. |
| UYGULANMADI | 501 | The requested resource is recognized but not implemented. |
| HATALı Ağ GE | 502 | Invalid response received when acting as a proxy or gateway. |
| HIZMET KULLANILAMIYOR | 503 | The server is currently unavailable. |
| Ağ GEçILI | 504 | Did not receive a timely response from upstream server while acting as a gateway or proxy. |
| HTTP SüRüMü DESTEKLENMIYOR | 505 | The HTTP protocol version used in the request message is not supported. |
| BAşLATMA | 550 | A failure occurred during initialization of services. API will be unavailable. |