Magidoc

Examples for automation

Automations are a powerful way to perform complex, repeatable tasks automatically and without interaction to streamline processes, ensure consistency across multiple systems and allow the business to self-serve. We provide an API to allow access to this functionality from a remote system.

Executing a workflow

#

To execute a workflow, we need to provide the name and namespace of that workflow, which is a workflow's unique identifier, as well as a customer to define the systems that can be involved in a workflow.

Additionally, workflows can require inputs so that they run on the correct systems and with the correct parameters. These inputs can either be supplied directly or a variant can be provided (by ID).

For example, to execute the test.hello-world workflow, we can use this mutation:

    
  

This will return the following status information:

    
  

The execution ID is important to record as this will allow us to use the next query to frequently check the current status of the workflow to determine when it succeeds, or report any errors.

Get the status of a workflow execution

#

As workflows could take anywhere from seconds to hours or days to execute (if they have manual steps waiting on an operator), the above mutation doesn't wait until the workflow completes, but simply returns with an ID that we can use to query the status in the future.

For example querying for execution ID 1554 using this query:

    
  

Could return the following result: