API Responses
CASE 1:
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- Exception when we map the "header" model with json
HTTP response code
400 OK
{
"errors": [
{
"code": "E0001",
"message":"Bad document header",
"detail":[]
}
]
}
CASE 2:
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- Exception when "header.format"! = "TDCS"
HTTP response code
400 OK
{
"errors": [
{
"code": "E0002",
"message":"Unknown document format",
"detail": ["Managed formats are: TDCS"]
}
]
}
CASE 3:
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- Exception when "header.format" == "TDCS" and "header.version"! = "1.0"
HTTP response code
400 OK
{
"errors": [
{
"code": "E0003",
"message":"Unknown document format version",
"detail":["Managed TDCS versions are: 1.0"]
}
]
}
CASE 4:
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- Exception when we map the "content" model with json
HTTP response code
400 OK
{
"errors": [
{
"code": "E0004",
"message":"Bad document content",
"detail":[]
}
]
}
CASE 5:
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- Exception when document identifier is invalid (4 possible reasons)
(you have to do a left and right trim to remove the spaces before checking the 3 fields) !!
HTTP response code
400 OK
{
"errors": [
{
"code": "E0005",
"message":"Invalid document identifier",
"detail": [
"DOCNUM - Identification number of the document is empty",
"TIDNUM - Tax identification number of the company is empty",
"DOCDAT - Document date is empty",
"DOCDAT - Document date format is invalid (YYYYMMDD)"
]
}
]
}
CASE 6:
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-Exception when document exists and status does not allow updating
HTTP response code
400 OK
{
"errors": [
{
"code": "E0006",
"message":"Document already exists and can't be updated",
"detail": {
"STATUS" : ["Document locked as status is now different from waiting"],
"EDITED" : ["Document locked as content already modified"],
}
}
]
}
CASE 7:
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- Document inserted or updated with possibly non-blocking validation errors
HTTP response code
200 OK
{
"errors": [
{
"code": "W0001",
"message":"Missing required field",
"detail": {
"OPERAT": [],
"DOCDES": []
}
},
{
"code": "W0002",
"message":"Invalid field value format",
"detail": {
"OPERAT": ["list of values: receivable, release"],
"DOCDES": ["xxxxxxxxxxxxxxxx", "yyyyyyyyyyyy"]
}
}
]
}