Skip to content
Timon G edited this page Jun 10, 2021 · 2 revisions

Some thoughts about how a REST-API could looks like

General

  • Most of the API stuff should happen via the endpoint /spools or similar
  • If the endpoint is called without any further URL parameters all spools should be considered
  • If a spoolID is supplied like /spools/<spoolID> the operation should be applied to the single spool
  • Basic CRUD operations should be supported

Operations

Multiple Spools

  • GET /spools - returns all spools that are currently known to SpoolManager
  • GET /spools/archive - I don't know whether this is relevant, but maybe nice to access archived spools (if that is possible)

Single Spool

  • GET /spools/<spoolID> - returns information about the provided spool
  • GET /spools/active - returns information about the currently loaded spool (same information as a normal GET)
  • PATCH /spools/<spoolID> - should partially update the spool with the provided information (from my point of view nothing should be mandatory in the body (spoolID is already supplied via URL parameter))
  • DELETE /spools/<spoolID> - delete or archive the spool

Return Values

I think the endpoint for a single spool should return all the available information about a spool. I don't think that the overview endpoint should return everything though, as this can result in quite a big response JSON. I think the most important parameters that should be returned here are:

  • ID
  • Name
  • Manufacturer
  • Material
  • Color
  • First Use
  • Last Use
  • Weight original
  • Weight left

Resource Model

  • ....