-
-
Notifications
You must be signed in to change notification settings - Fork 700
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposal — Datasette JSON API changes for 1.0 #2360
Comments
My one and maybe only comment here is that there doesn't seem to be any logic I can determine around when an api starts with This feels like an implementation detail getting hoisted to the interface, and if that could be different it would aid in comprehension and the inevitable countless "arg, right, |
Datasette's core URL design works like this:
The So we have a family of things under
Then things under
And things under
We may even have |
Is there a verb or noun that When I look at the proposal, how should I "read" It seems like it "should" be (if this is an API standard I'm not aware of, happy to read those docs instead, but I couldn't find a reference on the JSON API page of datasette) |
I think of it as "datasette function" as everything that follows a dash isn't a database name or a resource inside the DB, but a method provided by datasette that works on the resource before it. |
refs #1509
To prepare for Datasette 1.0, we want to standardize and document all the HTTP API endpoints that every Datasette instance offers. This proposal goes over single single standard JSON API endpoint we should implement + document for Datasette 1.0.
In general, there are very few breaking changes:
/.json
, (ie https://latest.datasette.io/.json) endpoint will be removed./database/table.json?sql=select...
endpoint for getting JSON results of an SQL query would be replaced with/database/-/query
, but we will redirect the former to the latter so it shouldn't be "breaking"(I will be editing this top-level comment while the spec changes)
Instance-level endpoints
/.json
Will be deprecated.
/-/instance.json
Info about the entire Datasette instance.
- Instance-level metadata (title, description, etc.)
- A "initial look" at databases, tables, queries for the entire Datasette instance (first 100)
Show interface
/-/databases.json
A paginated view of all the databases in the instance
Show interface
/-/resources.json
A paginated view of all the tables, views, and queries in each database for the entire instance.
Show interface
Open question: Since
/-/resources
is a super-set of tables/views/queries, do we even need them?These other endpoints would be unaffected:
/-/versions.json
/-/plugins.json
/-/settings.json
/-/config.json
/-/threads.json
/-/actor.json
Database Endpoints
/$DB.json
Returns info about a specific database named
$DB
for the Datasette instance.Show interface
/$DB/-/resources.json
Returns "resources" (tables, views, canned queries) for the given database.
/$DB/-/query.json?sql
=...Perform an SQL query on the specific database and return the results.
"Resource" (Table, View, and Query) endpoints
/$DB/$RESOURCE.json
Returns info about the specified resource (table, view, query, etc.).
Show interface
_extra=database_metadata
_labels=on
Row endpoints
Returns info about a specific row, and optionally about the table/database of the row..
/-/$DB/$TABLE/$ID[s].json
The text was updated successfully, but these errors were encountered: