Skip to content
Docs

GraphQL services

A GraphQL service is imported from its schema. Publicus reads the schema, stores every query and mutation it declares, and makes them selectable on the GraphQL Operation node and the GraphQL Operation Pack.

You can call a GraphQL endpoint without importing anything, by writing the document yourself on the operation node. Importing buys you two things: a picker instead of a hand-written document, and a pack that can tell a query from a mutation.

From GraphQL services, the GraphQL tab of APIs under Services, create one and fill in:

  • Name — how you will recognise it later.
  • Endpoint — the one URL every query and mutation posts to. This cannot be read out of the schema, because a schema does not contain it, and introspection needs it before there is a schema at all.
  • Where does the schema come from? — one of three answers below.
The Create GraphQL service form: Name, Endpoint, Where does the schema come from? with Introspect the endpoint selected, and the Connection to read it with
The Create GraphQL service form: Name, Endpoint, Where does the schema come from? with Introspect the endpoint selected, and the Connection to read it with
Source Use it when
Introspect the endpoint The default, and usually the right answer. Publicus asks the endpoint to describe itself.
Paste the schema You have the SDL in hand. An introspection response in JSON is accepted here too.
Fetch a published SDL The service publishes a .graphql document at a URL. Few do.

Introspection is a normal GraphQL query, so it runs as whoever asks. Select a Connection and the schema is read with that credential.

Reading happens while you are still on the form, so a wrong endpoint or a refused credential is a field error rather than an empty saved service.

The Create GraphQL service form with Introspect the endpoint selected and an error under Endpoint: the endpoint refused introspection
The Create GraphQL service form with Introspect the endpoint selected and an error under Endpoint: the endpoint refused introspection

One row per query and mutation, searchable by name from the service’s operations list. The list also has a filter for services that read out to nothing, which usually means introspection was disabled on the endpoint or the pasted document was not a schema.

The GraphQL services list: each service's Ingest state and operation count, one Ready with 3 operations and one Not ingested with 0
The GraphQL services list: each service's Ingest state and operation count, one Ready with 3 operations and one Not ingested with 0
A service's GraphQL operations list, grouped by type, with one mutation and two queries
A service's GraphQL operations list, grouped by type, with one mutation and two queries

Saving re-reads when the schema source changed, or when nothing has been read out of the service yet. Renaming does not re-read.

Re-ingest on the edit page re-reads unconditionally. Use it after the service ships schema changes — a new field or a removed mutation will not appear until you do.

  • GraphQL Operation runs one query or mutation as a flow step. Parameterise it with GraphQL variables rather than interpolating flow data into the document.
  • GraphQL Operation Pack exposes several operations to an agent as tools. Because each stored operation records whether it is a query or a mutation, a query tool does not inherit the approval a mutation needs — which the single operation node cannot offer, since a hand-written document is opaque.