home / docs / sections

sections: json_api:tablesetcolumntypeview

This data as json

id page ref title content breadcrumbs references
json_api:tablesetcolumntypeview json_api tablesetcolumntypeview Setting a column type To set a column type for a table column, make a POST to /<database>/<table>/-/set-column-type . This requires the set-column-type permission. POST /<database>/<table>/-/set-column-type Content-Type: application/json Authorization: Bearer dstok_<rest-of-token> { "column": "title", "column_type": { "type": "email" } } This will return a 200 response like this: { "ok": true, "database": "data", "table": "posts", "column": "title", "column_type": { "type": "email", "config": null } } To provide column type configuration, include a config object: { "column": "title", "column_type": { "type": "url", "config": { "max_length": 200 } } } To clear an existing column type assignment, set column_type to null : { "column": "title", "column_type": null } This API stores the assignment in Datasette's internal database, so it can be used with immutable databases as well as mutable ones. Any errors will return {"errors": ["... descriptive message ..."], "ok": false} , and a 400 status code for a bad input or a 403 status code for an authentication or permission error. ["JSON API", "The JSON write API"] []
Powered by Datasette · Queries took 2.494ms