본문으로 건너뛰기
Reincubate

Tasks

게시일: 2019년 6월 27일· 업데이트: 2020년 2월 25일

Cover image for: Tasks

A task is responsible for performing all asynchronous workloads on the API, such as establishing a session with external services, and retrieving and processing data.

Tasks are most commonly created as part of the creation of a session resource or during the execution of a poll.

Any data returned from a task is described by any associated result resources.

Some tasks, mainly involved with system and organisation management, may not target a user, source or session, or be associated with a poll. Examples of this kind of task are the storage and webhook config test tasks.

Attributes

nametypedescription
idtask IDResource identifier.
resourcestring, always taskResource type specifier.
organisationorganisation IDThe organisation the resource belongs to.
keykey IDThe key associated with this task.
useroptional, user IDThe user associated with this task.
sourceoptional, source IDThe source targeted by this task.
sessionoptional, session IDThe session used by this task.
polloptional, poll IDThe poll this task is associated to.
source_typeoptional, stringThe type of source this task is targetting.
typestringThe task type of the task.
targetstringThe highest level argument to the task. For example, a data type task will have the data type it is retrieving as the target (i.e. messages.sms).
statestringOne of: pending, processing, suspended, succeeded, failed.
resultslist object containing result resourcesAny results published from the execution of the task.
erroroptional, stringPopulated with the error code, if one occurred.
date_createddatetimeWhen the resource was created.
date_startedoptional, datetimeWhen task processing began.
date_completedoptional, datetimeWhen task precessing finished.

Source types

If the task is associated to a source, the type of the source will be denormalised onto the source_type task attribute. This helps simplify queries for tasks of a certain type.

Types

The task type is a short slug identifying the underlying task being executed within the API.

If the task relates to activity against a resource, such as testing a webhook config, it will be formatted like webhook_config.test.

If the task targets a specific source, then the source_type attribute will store the source related information, while the type attribute only stores the main action. For example, creating a session will trigger an session.init task to be created against a source of type icloud.account.

Target

This specifies the target of the underlying task, and is not always set. For example, the target of a webhook_config.test will be the ID of the webhook config to be tested. For a data task against an icloud.account type source, it will be the data type to be retrieved like messages.whatsapp.

State

  • pending the task has been created but is currently waiting in queue.
  • processing the task is being executed by an API worker.
  • suspended the task is waiting for blocking tasks to complete before proceeding.
  • succeeded the task completed without errors.
  • failed the task encountered errors.

Errors

If the task runs into issues during processing this field will be set with the code of the error encountered.

Changelog

2020-02-20

  • Major The results attribute of the task object is now a nested list object, rather than a simple list attribute.

2019-10-16

  • The state attribute of the task object can now have the value suspended. This indicates that the API is awaiting completion of actions by the Reincubate Relay application, such as a file upload or metadata update, for it to resume and complete the task.

Retrieve GET /tasks/{task ID}

Using cURL

curl https://ricloud-api.reincubate.com/tasks/<task ID> \
  -H 'Authorization: Token <your key_token>'

Using ricloud-py

import ricloud

task = ricloud.Task.retrieve(<task ID>)

Sample response

{
  "id": "00000001-1234-1234-1234-9876543210",
  "resource": "task",
  "organisation": 1,
  "key": 1,
  "user": 1,
  "source": 1,
  "session": "00000002-1234-1234-1234-9876543210",
  "poll": "00000003-1234-1234-1234-9876543210",
  "source_type": "mocks.mock",
  "type": "info",
  "target": null,
  "results": {
    "data": [],
    "has_more": false,
    "total_count": 1,
    "url": "/tasks/00000001-1234-1234-1234-9876543210/results"
  },
  "state": "processing",
  "error": null,
  "date_created": "2020-02-20T11:59:15.110451Z",
  "date_started": "2020-02-20T11:59:15.207932Z",
  "date_completed": null
}

List GET /tasks

Parameters

nametypedescription
keykey IDFilter by the associated organisation.
useruser IDFilter by the associated user.
sourcesource IDFilter by the associated source.
sessionsession IDFilter by the associated session.
pollpoll IDFilter by the owning poll.
source_typestringFilter by the source type.
typestringFilter by the task type.
statestringFilter by the task state.
date_createddatetime filterFilter by resource creation date.
date_starteddatetime filterFilter by when the task began processing.
date_completeddatetime filterFilter by when the task completed processing.

Using cURL

curl https://ricloud-api.reincubate.com/tasks \
  -H 'Authorization: Token <your key_token>'

Using ricloud-py

import ricloud

tasks = ricloud.Task.list()

관련 문서

도움이 필요하신가요?

모든 문의에 영업일 기준 1일 이내에 답변드리도록 노력하고 있습니다.

support@reincubate.com
King's Award for Enterprise 로고

King's Award for Enterprise: Reincubate는 영국 최고의 공식 비즈니스 영예를 네 차례 수상했으며, 가장 최근에는 지난 3년간의 뛰어난 성장을 인정받았습니다.

사용자 및 파트너와의 관계는 우리의 가치와 우리가 만드는 제품의 핵심입니다. 리뷰을(를) 통해 그들의 이야기를 들어보세요.

Centre for Assessment의 ISO 27001 인증, UKAS 공인

© 2008-2026 Reincubate Ltd. 모든 권리 보유. 잉글랜드 및 웨일스 등록 번호 5189175, VAT 번호 GB151788978. Camo®, Streamlight® 및 Reincubate®는 등록 상표입니다. 특허 출원 중.

도움말