Skip to content
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.

Latest commit

 

History

History
74 lines (43 loc) · 2.01 KB

api_tasks.md

File metadata and controls

74 lines (43 loc) · 2.01 KB

Tasks API Reference

This reference does not cover the JSON payload supplied to each endpoint. That is documented in detail in Understanding Tasks.

We recommend using the Receptor http client to communicate with Diego's API. The methods on the client are self-explanatory.

When making a POST or a PUT request to the Receptor HTTP API with a JSON payload, clients should include a Content-Type: application/json header in the request. If a different header is present, it may interfere with the correct processing of the request.

Creating Tasks

To create a Task submit a valid TaskCreateRequest via:

POST /v1/tasks

Fetching Tasks

Fetching all Tasks

To fetch all Tasks:

GET /v1/tasks

This returns an array of TaskResponse objects

Fetching Tasks by Domain

To fetch all Tasks in a given domain:

GET /v1/tasks?domain=domain-name

This returns an array of TaskResponse objects

Fetching a Specific Task

To fetch a Task by task_guid:

GET /v1/tasks/:task_guid

This returns a single TaskResponse object or 404 if none is found.

Resolving Completed Tasks

When a Task enters the COMPLETED state (see The Task Lifecycle for details) you are responsible for resolving it.

This is done via:

DELETE /v1/tasks/:task_guid

You can only resolve a task in the COMPLETED state. Anything else is an error.

Cancelling Inflight Tasks

Tasks in the PENDING and RUNNING states (see The Task Lifecycle for details) can be cancelled. This results in a Task in the COMPLETED state with failed = true.

To cancel a task:

POST /v1/tasks/:task_guid/cancel

Note, you must resolve the cancelled Task once it enters the COMPLETED state.

back