13586 shaares
342 private links
342 private links
Thoughts to write a REST API for a database. The first endpoints are easy to manage.
It's always about the details:
- Should you be allowed to update the primary key of an existing record?
- What happens if you try to insert a record that violates a foreign key constraint?
- What happens if you try to insert a record that violates a unique constraint?
- How should inserting binary data work, given that JSON doesn’t have a binary type?
What permissions should the different API endpoints require (I’m looking to add a bunch of new ones) - How should compound primary keys be treated?
- Should the API return a copy of the records that were just inserted? Initially I thought yes, but it turns out to be a big impact on insert speeds, at least in SQLite versions before the RETURNING clause was added in SQLite 3.35.0 (in March 2021, so not necessarily widely available yet).
- How should the interactive API explorer work? I’ve been building that in this issue.