Deepomatic API v0.7
  • What is Deepomatic API?
  • Authentication
  • Quick Start
  • Neural Networks
  • Recognition Specification
  • Recognition Version
  • Inference output
  • Tasks
  • Common objects
  • Errors
Powered by GitBook
On this page
  • Task object
  • Definition
  • Response
  • Get single task status
  • Definition
  • Arguments
  • Code sample
  • Response
  • Get multiple task status
  • Definition
  • Arguments
  • Code sample
  • Response

Was this helpful?

Tasks

PreviousInference outputNextCommon objects

Last updated 4 years ago

Was this helpful?

Task object

Definition

Some endpoints do not return a direct response. Instead they return a task_id which will contain the results once ready. In most cases you will need to until the status is not pending. The status will then either be:

  • success: in which case you can read the data field to access the expected response.

  • error: in which case the error field will contain an error message and the data field will be null.

Attribute

Type

Description

id

string

The task ID

status

string

The task status, either "pending", "success", or "error"

error

string

Defined in case of error, it is the error message

date_created

string

The creation data timestamp

date_updated

string

The timestamp where status switched from "pending" to another status

data

object

The response JSON of the endpoint that generated the task

Response

JSON
{
    "id": "269999729",
    "status": "success",
    "error": null,
    "date_created": "2018-03-10T20:38:12.818792Z",
    "date_updated": "2018-03-10T20:38:13.032942Z",
    "data": {
        "outputs": [
            {
                "labels": {
                    "discarded": [],
                    "predicted": [
                        {
                            "threshold": 0.025,
                            "label_id": 207,
                            "score": 0.952849746,
                            "label_name": "golden retriever"
                        }
                    ]
                }
            }
        ]
    },
    "subtasks": null
}

Get single task status

Definition

This endpoint retrieves the state of a given task.

TASK_ID=123
curl https://api.deepomatic.com/v0.7/tasks/${TASK_ID} \
-H "X-API-KEY: ${DEEPOMATIC_API_KEY}"
client.Task.retrieve({TASK_ID})

Arguments

Parameter

Type

Default

Description

task_id

string

The task ID

Code sample

curl https://api.deepomatic.com/v0.7/tasks/269999729 \
-H "X-API-KEY: ${DEEPOMATIC_API_KEY}"
import os
from deepomatic.api.client import Client
client = Client(api_key=os.getenv('DEEPOMATIC_API_KEY'))

client.Task.retrieve(269999729)

Response

JSON
{
    "id": "269999729",
    "status": "success",
    "error": null,
    "date_created": "2018-03-10T20:38:12.818792Z",
    "date_updated": "2018-03-10T20:38:13.032942Z",
    "data": {
        "outputs": [
            {
                "labels": {
                    "discarded": [],
                    "predicted": [
                        {
                            "threshold": 0.025,
                            "label_id": 207,
                            "score": 0.952849746,
                            "label_name": "golden retriever"
                        }
                    ]
                }
            }
        ]
    },
    "subtasks": null
}

Get multiple task status

Definition

Retrieve several tasks status given their IDs.

GET https://api.deepomatic.com/v0.7/tasks
tasks = client.Task.list(task_ids=[...])

Arguments

Parameter

Type

Default

Description

task_ids

array(string)

The task IDs as a JSON array of strings

Code sample

curl https://api.deepomatic.com/v0.7/tasks?task_ids=269999729&task_ids=269999730 \
-H "X-API-KEY: ${DEEPOMATIC_API_KEY}"
import os
from deepomatic.api.client import Client
client = Client(api_key=os.getenv('DEEPOMATIC_API_KEY'))

tasks = client.Task.list(task_ids=[269999729, 269999730])

Response

Attribute

Type

Description

count

int

The total number of results.

next

string

The URL to the next page.

previous

string

The URL to the previous page.

results

JSON
{
    "count": 2,
    "next": null,
    "previous": null,
    "results": [
        {
            "id": "269999729",
            "status": "success",
            "error": null,
            "date_created": "2018-03-10T20:38:12.818792Z",
            "date_updated": "2018-03-10T20:38:13.032942Z",
            "data": {
                "outputs": [
                    {
                        "labels": {
                            "predicted": [
                                {
                                    "threshold": 0.025,
                                    "label_id": 207,
                                    "score": 0.952849746,
                                    "label_name": "golden retriever"
                                }
                            ],
                            "discarded": []
                        }
                    }
                ]
            },
            "subtasks": null
        },
        {
            "id": "269999730",
            "status": "success",
            "error": null,
            "date_created": "2018-03-10T20:39:47.346716Z",
            "date_updated": "2018-03-10T20:39:47.553246Z",
            "data": {
                "outputs": [
                    {
                        "labels": {
                            "predicted": [
                                {
                                    "threshold": 0.025,
                                    "label_id": 207,
                                    "score": 0.952849746,
                                    "label_name": "golden retriever"
                                }
                            ],
                            "discarded": []
                        }
                    }
                ]
            },
            "subtasks": null
        }
    ]
}

It returns a .

A paginated list of .

array()

A list of .

get the task
task object
task objects
object
task objects