Spring REST in a nutshell

I will cover following topics :
  • Review Service : Naming your resources.
  • Create resources.
  • Add HATEOAS
  • Sub Resource.
  • Pagination.
  • Partial update.
  • Content negotiation.
  • Partial Query.
  • Caching.

Naming Resources :

Resource GET POST PUT DELETE
/reviews Get All reviews. Create a Brand new Review. Update multiple reviews or bulk update. Delete All Reviews.
/reviews/{id} Get an Specific Review. Not applicable. Update an Specific Review, identified by the id. Delete an Specific Review, identified by the id.

Guidelines : 

  • Consider noun for naming your resources, keep the resources in lowercase. You can use hyphens, underscore to name your resources.
  • Use plurals( e.g /reviews ) for collection of resources
  • Prefer more meaningful name, make it self descriptive.
  • To refer to child resources use sub-resource mechanism.
  • Try your resource name not to exceed 2000 characters.

Create resources:

Spin up your favorite IDE or https://start.spring.io/  and create following project.

function Panel(element, canClose, closeHandler) {
  this.element = element;
  this.canClose = canClose;
  this.closeHandler = function () { if (closeHandler) closeHandler() };
}