Knowledgebase

Building APIs With Python Print

  • python, errors, guide, howto, solution, zillionkinghost, hosting, support
  • 0

Programmatic interfaces.

WHAT AN API PROVIDES

Access to your application's functionality for other software.

WHAT TO DECIDE

What resources it exposes What each operation does What format it uses

WHAT MOST USE

JSON, over HTTP.

WHAT TO RETURN

Appropriate status codes Consistent structure Clear error messages

WHAT CONSISTENCY MEANS

The same shape for every response, including errors.

Clients depend on it.

WHAT TO DOCUMENT

Every endpoint: what it does, what it expects, what it returns, what errors are possible.

WHY

An undocumented API is unusable by anyone else.

WHAT TO IMPLEMENT

Authentication Rate limiting Validation of every input Versioning, if others depend on it

THE VERSIONING POINT

Once others use your API, changing it breaks them.

Version it before that happens.

WHAT NOT TO EXPOSE

Internal errors and tracebacks More data than the caller needs

WHAT TO LOG

Requests and failures, for diagnosis.


Was this answer helpful?
Back

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


Trustpilot