Skip to content
This repository has been archived by the owner on May 27, 2021. It is now read-only.

Latest commit

 

History

History
68 lines (41 loc) · 1.69 KB

urls.md

File metadata and controls

68 lines (41 loc) · 1.69 KB

URLs

BREAD

BREAD (Browse, Read, Edit, Add, Delete) is preferable to CRUD for browser based sites / apps.

  • [B]rowse: GET /projects or /projects?where[id][]=1&where[id][]=2
  • [R]ead: GET /projects/1
  • [E]dit: PATCH|GET /projects/1/edit
  • [A]dd: POST|GET /projects/add
  • [D]elete: REMOVE|GET /projects/1/delete

Notes:

  • Browse may return a subset of the entity properties and associations
  • Read may return all details of the entity properties and associations
  • Edit, Add and Delete may have GET endpoints for forms / confirmations

URL Query Parameters

Query parameters should be underscore.

References:

Pagination

Use ?page= & ?per_page= for url pagination params. Example: ?page=2&per_page=10

References:

Partial Responses

Use ?select= for partial responses. Example: ?select[0]['entity']=Project&select[0]['props'][]=id&select[0]['props'][]=title

References:

Search Criteria

Use ?where= for query criteria. Example: ?where[titleLike]=Proj

Ranges

Suffix ranges with Range

Example: ?where[submittedAtRange][start]=2013-31-01&where[submittedAtRange][end]=2013-31-08&where[submittedAtRange][inclusive]=1

Ranges contain a sub array of paramaters:

  • start
  • end
  • inclusive

Result Ordering

Use ?orderBy= for sort / ordering.

Example: ?orderBy[0]['prop']=submittedAt&orderBy[0]['sort']=ASC