You can use the Torq public API to manage workflows and workflow revisions. Go to the Workflows page to see some of the information available for each workflow.
The actions you can perform on workflows are:
- List all workflows and get information on a specific workflow
- Publish/Unpublish a workflow
- Import a workflow
- Update a workflow
- Delete a workflow
- List the parent workflows
Workflow revisions
A new revision of the workflow is created automatically every time anything in the workflow is changed (every time autosave is triggered). Revisions are created for both published and unpublished workflows. When you publish a workflow, you can provide a short description that will be attached to the published revision and will appear in the version history to help track changes.
Workflow tags
Use tags to sort your workflows so you can easily find your way through your workflow inventory.
You can use the Torq public API to programmatically manage the workflow tags from external systems and services.
Import a workflow
Use the Import a workflow
API request to:
- Import a workflow from a different account
- Import a YAML file that was manually changed
- Create a new workflow from a previous revision of a workflow
Retrieve a revision
request has to be escaped before it can be used as input for the Import a workflow
request.Import a workflow from a different account
When working with two different accounts, you have to make sure you're using the access token associated with the correct account in every API request you make.
To import a workflow from account A to account B:
1. Generate an access token for account A. Make sure you're using the client ID and client secret associated with account A to generate the access token.
2. Make a List workflows
request and find the workflow that you need in the list (or provide the optional workflow name input). Copy the workflow ID.
3. Make a Retrieve a workflow
request to get the ID of the current revision of the workflow.
4. Make a Retrieve a revision
request to get the content of the workflow revision in YAML format.
5. Escape the YAML output of the Retrieve a revision
request.
6. Generate an access token for account B. Make sure you're using the client ID and client secret associated with account B to generate the access token.
7. Make an Import a workflow
request. Use the Escaped YAML from step 5 as the input.
Escape a YAML
The input YAML for an Import a workflow
request must be escaped. Use the jsonEscape inline function to escape the whitespaces and special characters.