Skip to main content

Execute deployment

PUT 

/api/run

This endpoint allows you to execute a deployment on given inputs.

Request

When you perform a request to this endpoint, the following parameters should be included in the request body:

  • inputs: an array of objects representing the inputs of the deployment.
  • outputs: the list of workflow tasks (algorithms) for which you want outputs.
  • parameters: for each algorithm, the parameters you want to set (if any). These parameters will override the default parameters defined in the workflow.

Body

required

    inputs object[]required

    outputs

    object[]

    Array [

    task_name Task Namerequired
    task_index Task Index
    output_index Output Index

    ]

    parameters

    object[]

    Array [

    task_name Task Namerequired
    task_index Task Index

    parameters

    object

    [name] string

    ]

Inputs

A workflow can accept different types of inputs, from simple strings to complex objects. The input format is determined by algorithm implementation.

Most of the time, workflow takes an image as input, but it can also be any of Ikomia API's standard IO types.

Standard type inputs should be formatted in the JSON representation of the corresponding Python object defined in Ikomia API.

Image input

To send an image, just send it as a base64 encoded string:

{
"image": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAIBAQEBAQIBAQECAgICAgQDAgICAgUEBAMEBgUGBgYFBgYGBwkIBgcJBwYGCAsICQoKCgoKBggLDAsKDAkKCgr/2wBDAQ..."
}

Outputs

You should specify an output for each task in the workflow whose result you want to see. To do this, you should specify the following parameters for each task:

  • task_name: the name of the algorithm
  • task_index: if the algorithm appears multiple times in the workflow, the index of the wanted algorithm (default to 0 if not specified, corresponding to the first occurrence of the algorithm in the workflow, 1 for the second, etc.).
  • output_index: if the algorithm has multiple outputs, the index of the output you want to keep in the result (if not specified, all outputs of the given task will be returned).

The result of the execution will be a list of objects, each one corresponding to the output of a task, in the same order as the outputs parameter.

Parameters

For each task, you can override the default parameters defined in the workflow. You should provide the following parameters for each task:

  • task_name: the name of the algorithm
  • task_index: if the algorithm appears multiple times in the workflow, the index of the wanted algorithm (default to 0 if not specified, corresponding to the first occurrence of the algorithm in the workflow, 1 for the second, etc.).

Then, you should provide the list of parameters you want to override for this task as an object:

{
"task_name": "task_name",
"task_index": 0,
"parameters": {
"param1": "value1",
"param2": "value2"
}
}

Responses

When correctly formatted, your execution request will return a response with a status code 200 OK.

The response body is a JSON string containing the run ID of the execution.

"8ca4dda1-e52f-4be4-aed9-0e6db3da6bd3"
JSON

As the response body is JSON, the run ID is a prepended and appended with double quotes. Make sure to remove them when using the run ID in a request.

You can then use this run ID to fetch the result of the execution.

Loading...