Skip to main content

Operations

An operation is an action against your data. Where a resource describes what your data looks like, an operation describes what can be done with it — and every operation you define is exposed through the API as a GraphQL query or mutation.

Create an operation​

  1. Open Data in your workspace and go to the Overview tab.
  2. Choose Create Operation.
  3. Give it a Name; the Identifier is derived from it automatically.
  4. Choose the resource it acts on, then configure the fields below.
  5. Save.

Workspace-wide operations are listed under the Operations tab. An operation attached to a specific resource also appears in that resource's detail pane.

Kind​

Whether the operation is exposed as a GraphQL Query or a Mutation. Use Query for anything that only reads data, and Mutation for anything that changes it.

Behavior​

The behavior kind determines how the operation is actually carried out:

Behavior kindWhat it does
Database QueryRuns a query against a database.
API RequestCalls an external HTTP API.
CodeRuns custom code.
FlowTriggers an Automation flow.

Each behavior kind has its own settings — a database query needs the query itself, an API request needs the endpoint and how to build the request, and so on.

Method​

The method describes the shape of the operation, which is what tells DashX how to generate its arguments and return type:

MethodShape
GETFetch a single record.
LISTFetch many records.
AGGREGATEReturn a computed value over a set of records, such as a count.
CREATEInsert a new record.
UPDATEModify an existing record.
DESTROYDelete a record.
IMPORTBring records in in bulk.
GENERICAnything that doesn't fit the shapes above. Use this when the operation is custom enough that DashX shouldn't infer a shape for it.

Acts on​

Whether the operation applies to a single record or to the collection as a whole:

  • Member — acts on one record, so it needs that record's identifier.
  • Collection — acts on the resource as a whole.

A GET or UPDATE is typically a member operation; a LIST or AGGREGATE is typically a collection operation.

Parameters​

Parameters are the inputs an operation accepts, and they become the arguments of the generated GraphQL field. Each parameter has a name, an identifier, and a data type, and can be marked as required.

Response mapping​

When an operation's underlying behavior returns a payload that doesn't already match the shape you want to expose — a nested API response, for example — a response mapper reshapes it. There are two kinds:

  • Key — return the value found at a given key in the response.
  • Function — a transformation function that receives the response data as its input and returns the reshaped result.

Calling operations​

Operations are available everywhere the rest of your data is: through the GraphQL API, the REST API, the dashboard UI, and the CLI. See the SDKs section for calling them from your application code.