MDRUGB

Erori

Referință API / Prevederi generale / Erori
Schimbat: 08.04.2023 02:54

Erori

Fiecare apel API returnează un cod de stare HTTP care reflectă natura răspunsului. Am făcut tot posibilul să respectăm convențiile despre codurile de stare HTTP.

Orice solicitare nereușită returnează o eroare 4xx sau 5xx.

Un interval de 4xx înseamnă că a apărut o problemă cu cererea, cum ar fi un parametru lipsă. Un interval 5xx înseamnă că ceva a mers prost din partea noastră.

Toate răspunsurile de eroare vor conține un obiect cu aceste atribute:

Parametru Descriere
status Response status: "OK" or "FAIL"
data Object with response data
data: name HTTP status name
data:message Message in the selected query language
data: code Internal system response code (0 - successful response)
data:status Numeric HTTP response status
data: previous Internal system diagnostics in case of an erroneous response

Exemplu de răspuns:

{
  "status": "FAIL",
  "data": {
    "name": "Not Found",
    "message": "Page not found.",
    "code": 0,
    "status": 404,
    "previous": {
      "name": "Invalid Route",
      "message": "Unable to resolve the request \"\".",
      "code": 0
    }
  }
}

Interfața API e-Cont.md returnează următoarele coduri de stare HTTP:

200 - OK – Request succeeded
201 - Created – A resource was created
204 - No Content – Request succeeded but there is no response body

400 - Bad Request – Invalid request parameters
401 - Unauthorized – Incorrect or missing API key
403 - Forbidden – You do not have permission to view a resource or perform an action
404 - Not Found – The specified resource could not be found
429 - Too Many Requests – You’re moving too fast! Slow down!
500 - Internal Server Error – There was a problem on our end