Responses, pages and dates
Responses
Section titled “Responses”Responses are JSON. A single record (such as a purchase) comes back as an object, and a list comes back as an array of objects.
Two endpoints answer in plain text instead: verify a subscriber and verify a purchase notification.
Status codes
Section titled “Status codes”| Code | Meaning |
|---|---|
200 OK |
It worked. |
401 Unauthorized |
The username or API password is wrong. |
403 Forbidden |
You don’t have access to that record. |
404 Not Found |
Nothing found. See below. |
422 Unprocessable Entity |
The request didn’t pass validation. The body has an errors object. |
500 Internal Server Error |
Something went wrong on our side. |
503 Service Unavailable |
The API is down for maintenance or overloaded. Try again shortly. |
A 404 has this body:
{"status": "NOTFOUND"}You’ll get it when a record doesn’t exist, but also when a list is empty or
you ask for a page past the last one. So a search that matches nothing is a
404, not an empty array.
Lists return 100 records a page when you pass page:
curl -u YOUR_USERNAME "https://api.getdpd.com/v2/purchases?page=2"Leave page off and the API tries to return everything at once, which
isn’t guaranteed to work on a big account. To fetch a whole list, start at
page=1 and keep counting up until you get a 404.
Dates and times
Section titled “Dates and times”Dates in responses are UNIX timestamps, in seconds.
Date filters such as date_min and date_max accept anything PHP’s
strtotime()
does, like 2024-01-01 or last monday. They’re read in your account’s
time zone unless the value carries its own, as ISO 8601
(2004-02-12T15:19:21+00:00) and RFC 2822
(Thu, 21 Dec 2000 16:01:07 +0200) dates do.
Amounts are strings with two decimal places, like "19.99", so they don’t
lose precision on the way through a JSON parser. The currency is on the
storefront or purchase.