You can manage flows, revisions, and executions using GraphQL. This topic covers some of the most commonly used GraphQL queries and mutations.
Queries
These are some of the commonly used GraphQL queries for flows.
| Query | Arguments | Sample query |
|---|
flow Get a flow record. | id: The unique identifier of the flow. | flow(id: ID!): Flow |
getFlowRevisions Get all revisions for a flow record | id: The unique identifier of the flow. | getFlowRevisions(id: ID!): [Revision] |
getFlowExecutions Return executions details, including status, result (from aiWARE out node), and logs. | flowID: The unique identifier of the flow.
revisionID (optional): revision ID in the same flow
executionID (optional): execution ID in the same flow | getFlowExecutions(flowId: ID!, revisionId: ID, executionId: ID): [Execution] |
Mutations
These are some of the commonly used GraphQL mutations for flows.
createFlow
Creates a new flow with only the default fields.
mutation{
createFlow(): Flow
}
copyFlow
Creates a copy of an existing flow.
Arguments
flowID: The unique identifier of the flow. revisionID (optional): revision ID in the same flow
mutation{
copyFlow(flowId: ID!, revisionId: ID): Flow
}
updateFlow
Updates an existing flow.
Arguments
flowID: The unique identifier of the flow.
mutation{
updateFlow(flowId: ID!): Flow
}
deleteFlow
Deletes the flow record.
Arguments
flowID: The unique identifier of the flow.
mutation{
deleteFlow(flowId: ID!): Flow
}
pauseFlow
Updates the flows status to Not Active. The flow remains inactive until the unpauseFlow mutation is called.
Arguments
flowID: The unique identifier of the flow.
mutation{
pauseFlow(flowId: ID!): Flow
}
unpauseFlow
Activates a paused (not active) flow.
Arguments
flowID: The unique identifier of the flow.
mutation{
unpauseFlow(flowId: ID!): Flow
}
createFlowRevision
Creates a revision of a flow.
Arguments
flowID: The unique identifier of the flow. revision: Flow revision Type
mutation{
createFlowRevision(flowId: ID!,revision: Revision!): Revision
}
deleteFlowRevision
Marks a revision of a flow for delete.
Arguments
flowID: The unique identifier of the flow.revisionID: The ID of the revision
mutation{
unpauseFlow(flowId: ID!, revisionID: ID!): Revision
}
deployFlowRevision
This mutation does the following:
- Creates a new build from the revision specified or the latest (HEAD) revision (if no revision is specified).
- Changes the build status to deployed.
- Changes the deployed flag to true on the IS_DEPLOYED revision record.
Arguments
flowID: The unique identifier of the flow. revisionID (optional): The ID of the revision
mutation{
deployFlowRevision(flowId: ID!, revisionID: ID): Revision
}