Chuyển tới nội dung chính

Endpoints

An endpoint is one query published at one URL. This page covers the list of endpoints, how to create an endpoint, and how the editor is organised. Each editor tab has its own page.

The endpoints list with eight endpoints: six live, one draft and one disabled

The endpoints list​

Open Explore → Data API → Endpoints. The list shows every endpoint in the workspace.

ColumnWhat it shows
NameThe endpoint's name, with a star to bookmark it.
Method & pathThe HTTP method and the path callers append to the workspace's base URL, for example GET /orders/by-status. For a published endpoint this is the URL it is served on. When the draft has a new method or path, the line under it reads Pending publish: and the new one until you publish.
StateLive, Draft, or Disabled · was live (see lifecycle).
EngineThe engine of the endpoint's database connection, for example Trino.
Last editedWhen the draft last changed.

Above the table:

  • Search endpoints… filters by name.
  • State and Engine narrow the list. The counters under the filters (8 endpoints total · 6 live · 1 draft · 1 disabled) are clickable shortcuts for the State filter.
  • The toolbar buttons are Bookmarks (show only starred endpoints), Bulk select (select several rows and press Move N to Trash), New folder, and Trash.
  • Download OpenAPI exports an OpenAPI document; see OpenAPI export.
  • + Endpoint opens the create page.

Folders only organise the list. They are not part of the URL.

Row actions​

The ⋯ menu on a row offers:

ActionWhat it does
OpenOpens the editor.
DisableTakes a live endpoint out of service. Calls get 404 not_found. Its live version and grants are kept.
EnablePuts a disabled endpoint back, serving the version it had. Not available for an endpoint that was never published.
Move to new folder…Creates a folder and moves the endpoint into it. With folders in the workspace the menu also offers Move to "folder" for each one, and Remove from folder for an endpoint in a folder.
Move to TrashSoft-deletes the endpoint. Greyed out for a Live endpoint, with the hint Disable it first.

The row menu of the live endpoint Top customers: Open, Disable, Move to new folder and a greyed-out Move to Trash with Disable it first

In Trash, a row offers Restore (the endpoint returns disabled, never straight to serving) and Delete permanently, which cannot be undone.

Create an endpoint​

  1. Go to Explore → Data API → Endpoints and press + Endpoint.
  2. Fill in Name, Path, an optional Description, Method, Connection and SQL.
  3. Press Create endpoint.

The New endpoint page filled in for Customer spend on trino-demo

The create page collects only what an endpoint cannot exist without. Parameters, response shape, cache and limits are configured in the editor you land in next. Nothing is served yet: a new endpoint is a Draft.

FieldWhat it doesNotes
NameThe label shown in lists, and the operation summary in the OpenAPI document.Required.
PathThe URL path, appended to the workspace base URL.Required. See the path rules below.
DescriptionWhat the endpoint returns and who it is for. Becomes the operation description in OpenAPI.Optional.
MethodGET or POST.Default GET.
ConnectionThe connection the query runs on (Choose a connection).Required. Governed databases are labelled Governed; see Governed connections.
SQLThe query to publish.Required. One SELECT (or WITH … SELECT).

The page also shows a warning under Connection when you pick a governed connection that does not run queries as the caller. Both running and publishing are refused until that is fixed.

Path rules​

Paths are validated, not rewritten. A leading slash is optional and one trailing slash is dropped, so orders/by-status is stored as /orders/by-status. Anything else out of shape is refused with a message that names the reason:

  • empty segments (a//b) and . or .. segments;
  • whitespace or control characters;
  • percent-encoding, query strings and fragments;
  • characters outside A-Z a-z 0-9 . _ ~ - and /;
  • more than 512 bytes.

A workspace can hold only one endpoint per method and path pair. Creating a second GET /orders/by-status returns conflict: an endpoint already exists at GET /orders/by-status in this workspace. The same path with a different method is allowed.

What the SQL may contain​

Only a single read-only statement can be published: SELECT, or a leading WITH … SELECT. These are refused when you validate or publish:

SQLRefusal
DROP TABLE …, INSERT, DELETE and any other statementonly SELECT (or a leading WITH … SELECT) may be published; found DROP
SELECT 1; SELECT 2only one statement may be published: a ; may appear only at the very end
{{ name }} with no declared parameter namethe query references {{name}} but no parameter named name is declared

An endpoint can run several named statements. That is configured in the editor: see Several statements and scripted SQL.

The editor​

Opening an endpoint shows its editor. The header carries the name, a state badge such as Live · v2, and Save. Save is enabled only when there are unsaved changes, and leaving with unsaved changes asks for confirmation.

TabWhat you do therePage
QueryWrite the SQL, declare parameters, preview.Query with parameters, Statements
ConfigName, method, path, cache, limits, rate limits, validate.Cache, limits and rate limits
ResponseSee the frozen columns, set shape, naming, envelope and transform.Response shape
AccessGrant service accounts permission to call it.Access
Try itMake a real call as a service account.Try it
VersionsPublish, review history, roll back.Publishing

The header badge reads Draft · never published, Live · v2, Live · v1 · unpublished changes (the saved draft differs from what is served, as on Top customers in the walk-through) or Disabled · was live. Pressing the badge opens Versions.

A new path goes live at publish

Saving a new Path or Method in Config changes only the draft. Callers keep the live URL until you publish; then the new URL serves and the old one answers 404 not_found, with no redirect. Publishing reports the change as breaking. See Cache, limits and rate limits and Publishing.

Limits and known issues​

  • An endpoint has one method and one path, and one database.
  • At most 16 statements per endpoint.
  • Body parameters cannot be published: every parameter is read from the query string, for both GET and POST endpoints.

Further reading​