📄️ Data API overview
The Data API turns a SQL query into a REST endpoint. You write the query, declare the parameters callers may pass, publish it, and any program that holds an OAuth2 token can call it over HTTP and receive JSON. You do not write a service, deploy anything or hand out database credentials.
🗃️ Endpoints
7 mục
📄️ Clients
A consumer that calls your endpoints needs a credential. In the Data API that is an OAuth2 client owned by a service account. A service account is a machine identity: it is the "who" that endpoints grant access to and that the query engine sees. A client is one clientid and clientsecret pair that lets a program prove it acts for that account.
📄️ Call an endpoint with curl
This page walks through a complete call from a terminal: get a token, call an endpoint with parameters, read the response, and recognise what each failure looks like. Every request and response below was captured from the demo workspace.
📄️ OpenAPI export
Every consumer of an endpoint needs to know its URL, its parameters and the shape of its answer. Egret generates an OpenAPI 3.0.3 document from the published versions of your endpoints, so a client generator, an API explorer or a coworker reading the contract all see the same thing the endpoint serves.
📄️ Governed connections and running as the caller
An endpoint answers with whatever the query engine returns to the identity that ran the query. If the engine filters rows or masks columns per user (row filters and column masks in Ranger, for example), the endpoint must run the query as the right user, or every consumer would read what the shared credential can read. This page explains who "the caller" is for the Data API, and the rule Egret enforces for governed data.
📄️ Activity
Activity is the access log of the Data API: every call to one of the workspace's endpoints, with its status, duration and whether the cache answered. Use it to see who is calling what, find the call behind an error report, and spot an endpoint that has started to fail.
📄️ Error reference
Every refused call to the Data API answers with the same JSON body and a stable error.code. Branch on the code, not on the message: the message is for people and may be reworded.