What a call returns
A call returns the answer the API sends:success, then data, and for a list meta. See Pagination for the shape of meta. The names of the fields in data and meta are the ones in the API reference, written the way each language writes a name: hasNextPage in TypeScript, has_next_page in Python and Ruby, HasNextPage in C#, getHasNextPage() in Java and PHP, and GetHasNextPage() in Go.
Page through a list
A list that pages takespage, counting from 1, and size, from 1 to 100 (20 when you leave it out), and says in meta.hasNextPage whether there is another page. Pass them. GET /widgets answers with the whole list when you pass neither, and for an account with many widgets that answer can be cut short, with nothing in it to say so.
Create something safely
A call that creates or changes something takes an idempotency key, and the library asks you for it: the sample below shows where it goes in each language. A call sent without one is refused with400. The key is what lets you send the same call again, after a timeout or a dropped connection, and have the widget made once and not twice.
Make the key once for each thing you mean to do, before the first attempt, and send that same key on every retry. A UUID is a good key.
409 that says to wait. See Idempotency for both, and for what a key has to look like.
Read the headers of an answer
A call returns the body of the answer and, in most languages, nothing else. A few answers say something in a header:RateLimit-Remaining and RateLimit-Reset (see Rate limits), and X-Idempotency-Cached: true on an answer that was replayed. Each library has a second form of every call that returns them too:
getWidgets stands for any call: the name of every call takes the same ending (Raw in TypeScript, WithHttpInfo in Java, C# and PHP, _with_http_info in Python and Ruby).
Handle errors
When the API refuses a call, the library raises an error that holds the status and the body, and the body holds acode you can act on, such as RATE_LIMIT_EXCEEDED. When nothing answers at all (the network is down, the call timed out) the error is of another kind, and there is no status. This example handles both, and waits for Retry-After after a 429:
What to catch
The body of an error is the envelope described in Errors:
error.code to act on, error.message to show, and a correlationId to quote to the support team (see Using correlation IDs).
What to retry
The libraries leave the retry to you: a429 or a 503 reaches your code as an error, and the loop is yours to write. The one exception is Python. The HTTP client under it (urllib3) sends a GET, PUT or DELETE again, up to three times, when the answer is 429 or 503 with a Retry-After header, and waits as long as the header says, so the error reaches your code only after that. A POST or a PATCH is not sent again. To handle every error yourself, set retries=0 on the Configuration. Which errors are worth another attempt:
Retry strategies has a backoff loop you can copy.
Next steps
API classes
Find the class and the method for an endpoint
Errors
Every error code, with what to do about it