Knowledgebase

Consuming Someone Else's API Print

  • 0

Integrating with an external service.

WHAT TO ESTABLISH FIRST

What you actually need from it.

WHAT TO READ BEFORE CODING

Authentication Rate limits Error behaviour Whether a sandbox exists The terms of use

WHY THE TERMS SPECIFICALLY

They constrain what you may store, display and do.

WHAT TO BUILD FIRST

One successful call, by hand, from the command line.

WHY BY HAND

It separates interface problems from your code.

WHAT TO WRAP IT IN

A client of your own, rather than calls scattered through the application.

WHAT THAT PROVIDES

One place for authentication, retries, logging and error translation The ability to replace the provider

WHAT TO HANDLE

Timeouts Rate limiting Errors of every class Responses that are not what was documented

WHY THAT LAST POINT

Interfaces return undocumented shapes more often than anyone admits.

WHAT TO NEVER ASSUME

That a field will always be present That the response will always parse That the service will be available

WHAT TO SET

A timeout on every call.

WHY

Without one, a hanging call ties up your own resources indefinitely.

WHAT TO LOG

The request, the response status, and the time taken.

WHAT TO MONITOR

Error rates and latency, per provider.


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot