GoliathDevelopersGet an API key
Reference/Workflowsgenerated from the gateway manifest

promoteWorkflowDraft

Ship it: promote the workflow's current DRAFT to ACTIVE (live).

POST/api/v1/callWRITEidempotent · 24 hruns as the key's owner
View as Markdown

Ship it: promote the workflow's current DRAFT to ACTIVE (live). MIGRATE (default) moves in-flight runs to the new version: on a kept step they continue with the new copy, on a removed step they finish, held by a pause they wake. PAUSE keeps them on the old version, whose copy they send if resumed. Fails without a valid draft (see getWorkflow.draftValidation).

curl https://server.goliathdata.com/api/v1/call \
  -H "Authorization: Bearer $GOLIATH_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "operationId": "promoteWorkflowDraft",
    "variables": {
      "workflowGroupId": "<workflowGroupId>"
    }
  }'
import { GoliathClient } from '@goliath-data/sdk'

const goliath = new GoliathClient({
  apiKey: process.env.GOLIATH_API_KEY!,
  baseUrl: 'https://server.goliathdata.com',
})

const result = await goliath.workflows.promoteWorkflowDraft(
  {
    workflowGroupId: '<workflowGroupId>'
  },
  { idempotencyKey: crypto.randomUUID() },
)
const res = await fetch('https://server.goliathdata.com/api/v1/call', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.GOLIATH_API_KEY}`,
    'Content-Type': 'application/json',
    'Idempotency-Key': crypto.randomUUID(),
  },
  body: JSON.stringify({
    operationId: 'promoteWorkflowDraft',
    variables: {
      workflowGroupId: '<workflowGroupId>'
    }
  }),
})
const { data, errors } = await res.json()

Variables

The example sends only what the schema requires. Some operations also need one of several optional variables (one filter or another, say); the description above says which.

workflowGroupIdID!required
inFlightRunsStrategyInFlightRunsStrategy

How promote treats the superseded version's in-flight runs. PAUSE holds them there; MIGRATE (and LET_FINISH, run as MIGRATE) moves them to the new version. Default MIGRATE.

LET_FINISHPAUSEMIGRATE

Response

What comes back under data: a list shows as one entry, and a value as its type.

response shape
{
  "data": {
    "workflowAutomationsMutation": {
      "promoteWorkflowGroupDraftToLive": {
        "id": "<ID>",
        "name": "…",
        "status": "DRAFT",
        "currentVersion": {
          "id": "<ID>",
          "name": "…",
          "status": "DRAFT"
        }
      }
    }
  }
}

Errors

Idempotency

Send an Idempotency-Key of 1 to 255 characters. A finished request retried with the same key replays its stored response, marked Idempotency-Replayed: true; one still in flight returns 409 idempotency_conflict. Keys expire after 24 hours. Write without fear →