Create a workflow

Create a workflow in a project using the API.


Introduction

A workflow is a Directed Acyclic Graph (DAG) of data and processing blocks. Workflows give users the possibility to access a data source through a data block and extract insights from the dataset using an algorithm applied with the help of processing blocks.

In this guide, you will learn how to initialize your project with your access token and create a workflow from scratch.

Create a project

After you signed up and logged in, the Projects dashboard is displayed. Create a new project by clicking on Start a Project.

start project

Provide a name to your project and add a description (optional).

Click on Save.

name project

Important

You can create a project exclusively on the console interface. Making API calls is only possible after you copied the project credentials.

Initialize project

Currently, accessing the UP42 API is on a project-by-project basis. To get started with making API calls, you need to generate an access token based on the project ID (variable PROJ) and project API key (variable PKEY). This token can only be used for a specific project you selected. For more information: Projects.

After finding the project credentials, generate the access token. For more information: Authentication.

Create a workflow

Create a file workflow_request.json that contains the request body for creating a workflow:

{
  "id": null,
  "name": "My first API Tutorial",
  "description": "get images from the UP42 console",
  "projectId": "$PROJ",
  "tasks": []
}

Create a new workflow based on the JSON request body and store the workflow ID into a new variable:

NEW_WORKFLOW=$(curl -s -L -X POST -H "Authorization: Bearer $PTOKEN" \
-H 'Content-Type: application/json' https://api.up42.com/projects/$PROJ/workflows \
-d @workflow_request.json | jq -j '.data.id')

Get the workflow tasks (this call shows an empty array, since we did not add any block/task yet):

curl -s GET -H "Authorization: Bearer $PTOKEN" \
https://api.up42.com/projects/$PROJ/workflows/$NEW_WORKFLOW/tasks \
| jq '.data'