Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions crates/flowctl/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,36 @@ flowctl draft create
flowctl draft author --source ~/estuary/flow/examples/citi-bike/flow.yaml
flowctl draft publish
```

### Working with the GraphQL API directly

`flowctl raw graphql` explores the control-plane GraphQL API and runs
operations against it. The schema is read by introspection, so it always
describes the API the active profile points at.

```console
# What can I call?
flowctl raw graphql operations
flowctl raw graphql operations mutation --search invite

# What shape is this type?
flowctl raw graphql describe InviteLink
flowctl raw graphql types --kind input-object --search alert

# The whole schema, as SDL.
flowctl raw graphql schema
```

Run a query or mutation with `exec`. The document comes from an argument,
from `--file`, or from stdin, and variables from `--variables` (a JSON
object) or repeated `--var name=value` pairs:

```console
flowctl raw graphql exec 'query { alertTypes { alertType } }'

flowctl raw graphql exec --var cap=read \
'query Q($cap: Capability!) { prefixes(by: {minCapability: $cap}) { edges { node { prefix } } } }'
```

The full response is printed as JSON, including its `errors`, and the
command exits non-zero when the API reported any.
3 changes: 3 additions & 0 deletions crates/flowctl/src/graphql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
//!
//! This module contains some common types for use with graphql queries.
//!
//! To explore the schema, or to run an operation without writing a typed query
//! first, see the `flowctl raw graphql` commands in `crate::raw::graphql`.
//!
//! We use the `graphql_client` crate for all graphql requests:
//! https://github.com/graphql-rust/graphql-client
//!
Expand Down
Loading
Loading