REST API styles
Each style is a template in New API. A template fills in the paths, methods, status codes, headers and schemas for that style. Every style runs on a deployed API through the same URL, keys and policies as any other endpoint.
Resource CRUD
GET /items,POST /items, andGET,PUT,PATCHandDELETEon/items/{id}.- A body that does not match the schema answers
400and never runs the flow. - A method the path does not define answers
405with anAllowheader.
Query and filter
GET /itemswithfilterandsortquery parameters, andGET /items/{id}.- The flow receives the parameters in
query. - A
sortvalue outside the defined list answers400.
Cursor pagination
GET /itemswithcursorandlimit. The flow returnsnextCursorfor the next page.- A
limitabove the defined maximum answers400.
Search with a body
QUERY /itemssends search criteria in the body of a safe, repeatable request.POST /items:searchis the same search for clients that cannot sendQUERY.- The body is validated like a
POSTbody.QUERYis listed inAllowand in CORS responses.
Optimistic concurrency
- A
GETanswer carries anETag. A request with a matchingIf-None-Matchanswers304. PUT,PATCHandDELETEsend the lastETaginIf-Match.If-Match: *matches any current version, andIf-Matchaccepts a list of tags.- A stale
If-Matchanswers412. - A missing
If-Matchanswers428on endpoints that declare a428response. The Design preview answers428the same way.
Bulk and batch
POST /items:batchtakes a list of items and answers207with one result per item.- Each result has its
indexandstatus. A failed item carries a problem details object for that item only.
Long-running operation
- The endpoint answers
202with aLocationheader at once. - Poll
Locationfor the status, and the result once the flow ends. - A failed operation reports
failedwithout the internal error text.
Actions on a resource
- A custom action is a path such as
POST /items/{id}:approve. - The action path is matched before the plain
/items/{id}path. - Another method on the action path answers
405. TheAllowheader lists the action methods.
File upload and download
- An upload is a
multipart/form-datarequest. The flow receives each form field and each file with its name, file name, content type, size and content. - An upload past the maximum upload size answers
413. - A download answers the file bytes with a
Content-Dispositionheader. File names outside ASCII are sent infilename*. - A download past the maximum download size answers
502.
Streaming
GET /items:watchanswers Server-Sent Events (text/event-stream). Each flow row is one event.GET /items:exportanswers JSON Lines (application/jsonl), one JSON object per line.- An idle stream receives a keep-alive comment. A stream that stays idle past the stream idle timeout ends.
- An error after the first event ends the stream with an error event in problem details format.
Callbacks and webhooks
- An operation lists its callbacks in the definition. The callback URL is read from the request,
as
{$request.body#/callbackUrl}. - When a long-running operation ends, each callback receives a
POSTwith the operation status. - Every callback carries an
X-DataLug-Signatureheader and anX-DataLug-Eventheader. - Callback URLs must use
https. Private and internal addresses are refused. - Webhooks are listed at the top level of the definition and appear in the reference docs.
Private Agents
- A long-running endpoint deployed to an environment on a Private Agent in pull mode runs on that agent. The agent picks the call up as work, with the pinned flow version.
- The operation status follows the agent's run: running, succeeded or failed.
- When the run succeeds, the operation returns the API Response: its status, headers and body.
- A request larger than 24 KiB is refused before it reaches the agent.
- The API Response is limited to 1 MiB.
- An API Response past the limit is not returned. The operation result is a
502problem of typeurn:datalug:problem:api:agent-result-too-large. - A synchronous endpoint on a pull mode Private Agent answers
409.