Skip to content

Workflow Endpoints

TeusTan edited this page Jan 8, 2020 · 3 revisions

Create Workflow

The endpoint for creating a workflow is /workflows/create and the data it requires is the following:

{
    'name': <str>, 
    'description': <str>, 
    'inputs': 
        [
            {
                "id": <str>, 
                "name": <str>, 
                "type": <data-type>,
            }, ...
        ], 
     'outputs': 
        [
            {
                "id": <str>, 
                "name": <str>, 
                "type": <output-type>,
                "<output-type>" : <OUTPUT-TYPE SECTION>
            }, ...
        ]
}

Here <data-type> is a choice between image or text; and <output-type> is a choice between binary, single-selection, multi-selection or freetext.

Below are the different output sections formats:

binary

{
    “options”: {
        true: "Yes", 
        false: "No"
    },
}

single-selection

{
    “options”: [
        { "id": "option-1-id", "name": "Option 1"},
        { "id": "option-2-id", "name": "Option 2"},
        { "id": "option-3-id", "name": "Option 3"}],
}

multi-selection

{
    “options”: [
        { "id": "option-1-id", "name": "Option 1"},
        { "id": "option-2-id", "name": "Option 2"},
        { "id": "option-3-id", "name": "Option 3"}],
}

freetext

{}

List Workflows

To get a list of the workflows in your organization you can do a GET call to /workflows/.

Retrieve and Update Workflow

To retrieve a specific workflow you can do so by calling GET to /workflows/<workflow-id>. To update the workflow you call the same endpoint but use PATCH instead along with a payload including the attributes you want to update. Below is an example of a payload for updating the description of a workflow:

{"description": "This is the new updated description of an existing workflow"}

Remember you will only have permission to retrieve and update the workflows which are part of your organization.

Upload CSV files

To upload CSV files you have to POST a message including the file to /workflows/<workflow-id>/upload/

Get list of Tasks

To get the list of tasks in a given workflow you should do call a GET to the endpoint /workflows/<workflow-id>/tasks/

Retrieve and UpdateTask

To retrieve a task you can either call a GET to the endpoint /workflows/<workflow-id>/tasks/next and this will give a incomplete task.

Another way is to retrieve a specific task and that is by doing a GET to the endpoint /workflows/<workflow-id>/tasks/<task-id>, if you do a PATCH to this endpoint you will be able to update the task. You will only be able to update the output.

Clone this wiki locally