HTTP Headers
The Rest API HTTP-POST and HTTP-PUT request all expect the content-type header to be set Content-Type: application/json
, unless explicit stated that a different content header is to be used.
All the responses of the Rest API are of type application/json
, unless explicitly stated otherwise.
Encoding
A request and response messages are encoded using UTF-8.
Error Response
Errors are indicated by the http status 4xx or 5xx. The JSON response contain the details of the error.
Response
Field | Type | M | Description |
---|---|---|---|
messages | String(1,255) [] | M | One or more messages giving details about the error. |
HTTP Status
Status | Meaning |
---|---|
400 (Bad Request) | The parameters or request are not valid. |
401 (Unauthorized) | Authorization header missing or invalid. |
403 (Forbidden) | The merchant key is not allowed or the request is not allowed. |
404 (Not Found) | The reference was not found. |
405 (Conflict) | The new reference was not unique. |
500 (Internal Server Error) | Something went wrong. |
Error response example
> curl \
-X POST \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic RG9jZGF0YVBGOkJXazJhZkpV' \
https://testsecure.docdatapayments.com/ps/api/public/v1/merchants/4ef08825-993a-424d-a769-3ee97116a1b6/orders \
-d '{
"reference" : "vk20170224p",
"description" : "Order 12345",
"amount" : 3330,
"currency" : "EUR",
"country" : "NLD"
}'
< Http 400 - Bad Request
< '{
"messages": [
"Property 'country' must match \"[A-Z]{2}\"",
"Property 'email' may not be null"
]
}'