Jump to content

User:DKinzler (WMF)/API Guidelines: Difference between revisions

From mediawiki.org
Content deleted Content added
OData
bits & pieces
Line 111: Line 111:
** conditionals
** conditionals
** redirects (normalization, deprecation, and other)
** redirects (normalization, deprecation, and other)
** content-type response header should reference spec (and version!)
** content-type response header should reference spec (and version)
*** version mismatch in accept header should trigger error response
*** version mismatch in accept header should trigger error response
*** content negotiation may be used
** other headers
** other headers
** guidance on urls vs header vs query param
** guidance on urls vs header vs query param
Line 124: Line 125:
** standard data types (date format, language codes, etc)
** standard data types (date format, language codes, etc)
*** https://opensource.zalando.com/restful-api-guidelines/index.html#data-formats
*** https://opensource.zalando.com/restful-api-guidelines/index.html#data-formats
** standard field names (rel, ref, etc) - compare https://cloud.google.com/apis/design/standard_fields?hl=en
** field names
(rel, ref, etc) - compare https://cloud.google.com/apis/design/standard_fields?hl=en
*** snake_case ascii identifier (prefix)?[a-z]+[a-z0-9]*(_[a-z]+[a-z0-9]*)
** schemas
** schemas
*** json, content-type
** pagination, ordering, filtering
** pagination, ordering, filtering
*** https://github.com/microsoft/api-guidelines/blob/vNext/Guidelines.md#98-pagination
*** https://github.com/microsoft/api-guidelines/blob/vNext/Guidelines.md#98-pagination
Line 172: Line 176:
** resources & collections (sub-collections, formats, nested resources, etc)
** resources & collections (sub-collections, formats, nested resources, etc)
*** nesting vs referense -> composition vs aggregation
*** nesting vs referense -> composition vs aggregation
** use American English nouns ([https://stackoverflow.com/questions/54057388/rest-api-resource-naming-conventions-user-or-users-pluralisation singlular or plural]?) (kebab-case or CamelCase?)
** use American English nouns ( ) (kebab-case)
*** https://stackoverflow.com/questions/6845772/should-i-use-singular-or-plural-name-convention-for-rest-resources
*** https://blog.dreamfactory.com/best-practices-for-naming-rest-api-endpoints/
** searching vs. listing
** searching vs. listing
** formats / file extension suffix
** formats / file extension suffix

Revision as of 16:33, 3 April 2023

Resources

REST best practice


Other Org's API Guidelines

For Clients

Bits & Pieces

Note to self: looked at: Adidas, Maturity, Atlassian, Whitehouse, Google, Microsoft, Heroku, Zalando, Atlassian, Stripe.

Typical Structure & Aspects


Clients

  • How to discover APIs
  • Where to find documentation and specs
    • common data types
    • error formats
    • paging
  • Relevant HTTP standards
    • resilience
    • handling 5xx
  • Retry and back-off
  • Relevant REST best practices
  • What is stable / unstable
    • use the latest version
    • don't rely on undocumented behavior
    • Do not start using deprecated APIs
    • don't use restricted APIs
  • Follow the ToS
  • Surface Deprecation and Sunsetting
    • Follow 308
  • Be nice
    • Consider the cost
    • Follow 429 / Retry-After
    • Be careful with concurrency
    • React to blocks (403?)
  • Set User-Agent
  • When and how to use auth
    • use OAuth when acting on behalf of others
    • csrf