Pittsburgh-NEH-Institute / pr-app

eXist-db app development
MIT License
3 stars 1 forks source link

GET or POST? #37

Closed djbpitt closed 2 years ago

djbpitt commented 2 years ago

Good API practice recommends GET, rather than POST, because a GET URI can be cited and also constructed manually. At the same time, a long GET URI looks messy, and ours are getting long if we use them to preserve the checkbox state. Should we favor GET or POST?

Notes:

  1. Query strings have a browser-determined length limit, which seems to be quite long in all major browsers, so perhaps not a real problem.
  2. A POST request may include a query string, but how to construct one in an HTML form is not clear, since the @method attribute values of GET and POST seem also to control whether there is or is not a query string.
  3. As an alternative to preserving the checkbox state with URL information we could use local or session storage. See https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API. Is web storage a better idea anyway because it requires less client-server traffic?
djbpitt commented 2 years ago

Decided to use GET