Status Codes & Error Messages
HTTP status codes
HTTP codes sent from the Send Payments API can be any of the standard HTTP status codes, but generally they will be from the following subset of codes:
Code | Description | Send Payments Usage |
---|---|---|
200 | OK | Response to successful GET request. |
201 | Created | Response to successful POST request - New resource created. The body parameter of the response will include the newly created resource. |
204 | No content | Response to successful DELETE request - The resource specified in the request has been successfully deleted. The body parameter of the response will NOT include the deleted resource. |
400 | Bad request | Response to unsuccessful POST request - The new resource has NOT been created. The body parameter of the response will NOT include the specified resource from the request but will include the details of the error(s) that caused the request to fail. See Status Codes & Error Messages. |
401 | Unauthorized | Indicates that the request has not been applied because it lacks valid authentication credentials for the target resource. |
404 | Not Found | Response to an unsuccessful GET request or POST request that includes a specific target resource. e.g. Where the target resource does not exist or is hidden by the server. |
409 | Conflict | The request could not be completed due to a conflict with the current state of the target resource. e.g. Where the resource already exists. |
500 | Internal Server Error | The server encountered an unexpected condition that prevented it from fulfilling the request. |
Errors
Error responses generally include a body with the following schema:
Body parameter key (JSON) | Underlying data type | Description |
---|---|---|
message | String | Human readable description of the HTTP error response. |
errors | Array[Object] | An array of error objects. |
error/message | String | Human readable description of the specific error object. Where the key value must be a value from an Enum or a List, then the message will include the allowed values. |
error/type | Enum | The type name of the error object. |
error/field (Only present for ValidationErrors) | String | The name of the key that does not pass the validation requirement. |
Example error message
{
"message": "Request contained errors",
"errors": [
{
"field": "body.physicalAddress.country(Errors of type ValidationError only)",
"message": "body.physicalAddress.country must be one of the following values: AU, GG, MC, AT, HK, NL, BE, HU, NZ, BG, IS, NO, CA, IN, PL, KY, IE, PT, CN, IM, HR, IL, RO, CY, IT, SG, CZ, JP, SK, DK, JE, SI, EE, KR, ZA, FI, LV, ES, FR, LI, SE, GF, LT, CH, DE, LU, TW, GI, MT, GB, GR, MQ, GP",
"type": "ValidationError"
},
{
"message": "body.termsAndConditionsAccepted is a required field",
"field": "body.termsAndConditionsAccepted",
"type": "ValidationError"
},
{
"message": "body has unspecified keys: statusCode",
"field": "body",
"type": "ValidationError"
}
]
}
Data validation errors
The body of each request sent to our system is checked for validity before we attempt to process it.
Some of the checks we do are:
-
Checking data types.
-
Checking Enum and List values.
-
Checking that required or conditionally required keys are present.
-
Checking for keys that should not be present.
Not Seeing What You're Looking For?
We are always looking to improve our API documentation to ensure Sends systems are easy to understand and quick to build against. If you're struggling to find the answer to a question we either haven't made it easy enough to find the relevant docs or we haven't had a chance to write something up for it yet.
Either way we want to hear from you!
Head over to our Discussion Board and leave us a note. We keep a close eye on this and want to ensure we make these docs as useful as they can be so will jump on any posts quickly.
Updated 6 months ago