Skip to content

RESTful Service Guide

Alexander edited this page Aug 25, 2016 · 10 revisions

We had some inconsistencys and open questions related to RESTful API design, which lead to ugly request URLs. This is why we define some basic guidelines here. The interested reader may continue his studies in this paper where some of these information were extracted from, and this book referenced from the paper.

NOTE: This is WIP, any contribution is welcome!

Principles

TODO: Short introduction to main REST principles:

  • Resources
  • Actions
  • Methods
  • Statelessness
  • Loose coupling
  • ...

Criteria

Criteria 1-12 are highly relevant while criteria 13-17 are related, but not highly relevant.

  1. Availability of Formal Description. TODO: Do we have this? Can we use Swagger for this?
  2. Links in Representations. Links to other resources are navigational help and provide follow-up actions. It allows a loose coupling between client and API since the client gets an URL where he can proceed. However, this is not possible in las2peer (yet?) since the service never knows the used endpoint (WebConnector) where he actually runs, so a service can only provide a relative link.
  3. Forms in Representations.
  4. Number of Resource Types.
  5. Versioned service endpoint. TODO: We will have an versioned service endpoint. Is this bad or not?
  6. Scoping Information
  7. Parameter Sources
  8. Meaningful HTTP Status Codes. Enhance error handling by sending reasonable HTTP status codes.
  9. HTTP Methods Used. Using just a single method can also point to an overloading of functionality.
  10. HTTP Method Override. Some browsers only accept only GET and POST.
  11. Representation Formats. Commonly used formats are XML, JSON, serialized PHP, ATOM, HTML and CSV
  12. Representation Format Selection.
  13. Parameter Sources
  14. Parameter Sources
  15. Parameter Sources
  16. Parameter Sources
  17. Parameter Sources