Skip to content

Instantly share code, notes, and snippets.

@farhadkzm
Last active September 15, 2017 02:14
Show Gist options
  • Save farhadkzm/fefffe35c7e4fd224cd8aeac759b61a7 to your computer and use it in GitHub Desktop.
Save farhadkzm/fefffe35c7e4fd224cd8aeac759b61a7 to your computer and use it in GitHub Desktop.
Notes on designing of a REST API. Mostly from Google's Design Guide for REST APIs
  • The core principle is to define named resources that can be manipulated using a small number of methods.
  • resources and methods are nouns and verbs of the API
  • resource names map to URLs and methods map to HTTP methods.
@farhadkzm
Copy link
Author

farhadkzm commented Jun 8, 2017

Versioning

A new major version of an API must not depend on a previous major version of the same API. An API may depend on other APIs with the understanding of dependency and stability risk associated with those APIs. A stable API version must only depend on the latest stable version of other APIs.

For some period of time, different versions of the same API must be able to work at the same time within a single client application. This is to help the client smoothly transition from the older version to the newer version of the API.

An older API version should only be removed after its deprecation period is over.

Common and stable data types that are shared by many APIs, such as date and time, should be defined in a separate proto package. If a breaking change ever becomes necessary, either a new type name, or a package name with a new major version must be introduced.

Compatibility
To put it another way: old clients should be able to work against newer servers within the same major version number, and when they want to update to a new minor version (for example to take advantage of a new feature) they should be able to do so easily.

@farhadkzm
Copy link
Author

farhadkzm commented Jun 9, 2017

URI and URL
Further according to the contemporary view, the term "URL" does not refer to a formal partition of URI space; rather, URL is a useful but informal concept: a URL is a type of URI that identifies a resource via a representation of its primary access mechanism (e.g., its network "location"), rather than by some other attributes it may have. Thus as we noted, "http:" is a URI scheme. An http URI is a URL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment