The response format comprises of the following elements.
Element | Description |
Data | Data returned by back-end program. |
Message |
Present if there are any business application errors. Identifies the message type with the following child elements.
Example: {“type”:”ERROR/WARNING/INFO”,”id”:”msgID”,”key”:”uniqueKeyOfMessage”,”field”:”fieldName”,”text”:”MessageText “} |
Error |
Present if there are any internal technical errors. Holds internal numeric error code and error text that identifies the type of error that’s occurred. Example: “error”:{“code”:-32nnn,”message”:”text”} Numeric error codesAPI_PARSE_ERR -32700 API_INVREQ_ERR -32600 API_METHOD_ERR -32601 API_PARAMS_ERR -32602 API_INTERNAL_ERR -32603 API_SECURITY_ERR -32603 API_APPLICATION_ERR -32500 Returned with business error API_SERVER_ERR -32000 |
ID |
Response ID (same ID as in the send request) Example: “id”:”1234567890″} |
Successful response
If a request is successful, then the response will not have the Error element. The message type may appear as either WARNING or INFO.
See example of successful response{
“IptorAPI”: “1.0”,
“data”: {
“xLockId”: “”,
“customerNumber”: “0000006480”,
“deliveryNumber”: 1,
“deliveryName”: “Abbey’s Bookshop”,
“deliveryAddressLine0”: “Opal Tower, Ground floor”,
“deliveryAddressLine1”: “136 George Street”,
“deliveryAddressLine2”: “”,
“deliveryAddressLine3”: “Sydney”,
“deliveryAddressLine4”: “NSW”,
“deliveryAddressLine5”: “2067”,
“deliveryAddressLine6”: “Australia”,
“deliveryPhoneNumber”: “”,
“deliveryFax”: “”,
“dxNumber”: “”,
“dxLocation”: “”,
“customerStatus”: “A”,
“alphaSearchKeyword”: “S1”
},
“id”: “1234567890”
}
Error response
If a request is unsuccessful, the message type would be either FATAL or ERROR and the response will have Error element.
See examples of error responsesTechnical error:
{
“IptorAPI”: “1.0”,
“error”: {
“code”: -32603,
“message”: “Internal error”
},
“id”: “1234567890”
}
Business/Application error:
{
“IptorAPI”: “1.0”,
“messages”: [
{
“type”: “TYP:ERROR”,
“id”: “I000002”,
“key”: “I”,
“field”: “I”,
“text”: [
“Invalid item.”,
“Cause . . . . . : The operator has entered an item that does not exist on the item masterfile. Recovery . . . : Change the entry to be valid.”
]
}
],
“error”: {
“code”: -32500,
“message”: “Application error”
},
“id”: “1234567890”
}