Tasks-2

For instructions on how to authenticate to use this endpoint, see API overview.

Endpoints

POST
GET
PATCH

Create tasks runs artifacts presign

Required API key scopes

task:read

Path parameters

  • id
    string
  • project_id
    string
  • task_id
    string

Request parameters

  • storage_path
    string

Response


Example request

POST /api/projects/:project_id/tasks/:task_id/runs/:id/artifacts/presign
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl
-H 'Content-Type: application/json'\
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/tasks/:task_id/runs/:id/artifacts/presign/\
-d storage_path="string"

Example response

Status 200 Presigned URL for the requested artifact
RESPONSE
{
"url": "http://example.com",
"expires_in": 0
}
Status 400 Invalid request
RESPONSE
{
"error": "string"
}
Status 404 Artifact not found

Retrieve tasks runs logs

Fetch the logs for a task run. Returns JSONL formatted log entries.

Required API key scopes

task:read

Path parameters

  • id
    string
  • project_id
    string
  • task_id
    string

Example request

GET /api/projects/:project_id/tasks/:task_id/runs/:id/logs
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/tasks/:task_id/runs/:id/logs/

Example response

Status 200 Log content in JSONL format
Status 404 Task run not found

Update tasks runs set output

Update the output field for a task run (e.g., PR URL, commit SHA, etc.)

Required API key scopes

task:write

Path parameters

  • id
    string
  • project_id
    string
  • task_id
    string

Response


Example request

PATCH /api/projects/:project_id/tasks/:task_id/runs/:id/set_output
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl -X PATCH \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/tasks/:task_id/runs/:id/set_output/

Example response

Status 200 Run with updated output
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"task": "4879b8a6-fb3e-4a0d-aef8-b0ea469ac85c",
"stage": "string",
"branch": "string",
"status": "not_started",
"environment": "local",
"log_url": "string",
"error_message": "string",
"output": null,
"state": null,
"artifacts": [
{
"name": "string",
"type": "string",
"size": 0,
"content_type": "string",
"storage_path": "string",
"uploaded_at": "string"
}
],
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"completed_at": "2019-08-24T14:15:22Z"
}
Status 404 Run not found

Community questions

Questions about this page? or post a community question.