workers

Asynchronous workers related operations

List all scheduled jobs

GET//www.data.gouv.fr/api/1/workers/jobs/
Header parameters
Response

Success

Body
argsarray of object

The job execution arguments

crontabCrontab (object)
descriptionstring

The job description

enabledboolean

Is this job enabled

idstring

The job unique identifier

intervalInterval (object)
kwargsobject

The job execution keyword arguments

last_run_atstring (date-time)

The last job execution date

last_run_idstring

The last execution task id

name*string

The job unique name

schedulestring

The schedule display

task*enum

The task name

Example: "test-high-queue"
test-high-queuetest-default-queueharvestupdate-datasets-reuses-metricspurge-harvest-jobspiwik-bulk-track-apitest-errormap-transport-datasetsrecommendations-cleantest-logcheck-integrityexport-csvrecommendations-addpurge-chunkspurge-datasetstest-low-queuecompute-geozones-metricssend-frequency-remindercompute-site-metricspurge-harvestersapigouvfr-load-apiscount-tagspurge-organizationsupdate-metricspurge-reuses
Request
const response = await fetch('//www.data.gouv.fr/api/1/workers/jobs/', {
    method: 'GET',
    headers: {},
});
const data = await response.json();
Response
[
  {
    "args": [],
    "crontab": {
      "day_of_month": "*",
      "day_of_week": "*",
      "hour": "*",
      "minute": "*",
      "month_of_year": "*"
    },
    "description": "text",
    "enabled": false,
    "id": "text",
    "interval": {
      "period": "days"
    },
    "last_run_at": "2024-09-20T06:13:44.809Z",
    "last_run_id": "text",
    "name": "text",
    "schedule": "text",
    "task": "test-high-queue"
  }
]

Create a new scheduled job

POST//www.data.gouv.fr/api/1/workers/jobs/
Header parameters
Body
argsarray of object

The job execution arguments

crontabCrontab (object)
descriptionstring

The job description

enabledboolean

Is this job enabled

idstring

The job unique identifier

intervalInterval (object)
kwargsobject

The job execution keyword arguments

last_run_atstring (date-time)

The last job execution date

last_run_idstring

The last execution task id

name*string

The job unique name

schedulestring

The schedule display

task*enum

The task name

Example: "test-high-queue"
test-high-queuetest-default-queueharvestupdate-datasets-reuses-metricspurge-harvest-jobspiwik-bulk-track-apitest-errormap-transport-datasetsrecommendations-cleantest-logcheck-integrityexport-csvrecommendations-addpurge-chunkspurge-datasetstest-low-queuecompute-geozones-metricssend-frequency-remindercompute-site-metricspurge-harvestersapigouvfr-load-apiscount-tagspurge-organizationsupdate-metricspurge-reuses
Response

Success

Body
argsarray of object

The job execution arguments

crontabCrontab (object)
descriptionstring

The job description

enabledboolean

Is this job enabled

idstring

The job unique identifier

intervalInterval (object)
kwargsobject

The job execution keyword arguments

last_run_atstring (date-time)

The last job execution date

last_run_idstring

The last execution task id

name*string

The job unique name

schedulestring

The schedule display

task*enum

The task name

Example: "test-high-queue"
test-high-queuetest-default-queueharvestupdate-datasets-reuses-metricspurge-harvest-jobspiwik-bulk-track-apitest-errormap-transport-datasetsrecommendations-cleantest-logcheck-integrityexport-csvrecommendations-addpurge-chunkspurge-datasetstest-low-queuecompute-geozones-metricssend-frequency-remindercompute-site-metricspurge-harvestersapigouvfr-load-apiscount-tagspurge-organizationsupdate-metricspurge-reuses
Request
const response = await fetch('//www.data.gouv.fr/api/1/workers/jobs/', {
    method: 'POST',
    headers: {
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      "name": "text",
      "task": "test-high-queue"
    }),
});
const data = await response.json();
Response
{
  "args": [],
  "crontab": {
    "day_of_month": "*",
    "day_of_week": "*",
    "hour": "*",
    "minute": "*",
    "month_of_year": "*"
  },
  "description": "text",
  "enabled": false,
  "id": "text",
  "interval": {
    "period": "days"
  },
  "last_run_at": "2024-09-20T06:13:44.809Z",
  "last_run_id": "text",
  "name": "text",
  "schedule": "text",
  "task": "test-high-queue"
}

List all schedulable jobs

GET//www.data.gouv.fr/api/1/workers/jobs/schedulables
Response

Success

Body
itemsstring
Request
const response = await fetch('//www.data.gouv.fr/api/1/workers/jobs/schedulables', {
    method: 'GET',
    headers: {},
});
const data = await response.json();
Response
[
  "text"
]

Fetch a single scheduled job

GET//www.data.gouv.fr/api/1/workers/jobs/{id}
Path parameters
id*string

A job ID

Header parameters
Response

Success

Body
argsarray of object

The job execution arguments

crontabCrontab (object)
descriptionstring

The job description

enabledboolean

Is this job enabled

idstring

The job unique identifier

intervalInterval (object)
kwargsobject

The job execution keyword arguments

last_run_atstring (date-time)

The last job execution date

last_run_idstring

The last execution task id

name*string

The job unique name

schedulestring

The schedule display

task*enum

The task name

Example: "test-high-queue"
test-high-queuetest-default-queueharvestupdate-datasets-reuses-metricspurge-harvest-jobspiwik-bulk-track-apitest-errormap-transport-datasetsrecommendations-cleantest-logcheck-integrityexport-csvrecommendations-addpurge-chunkspurge-datasetstest-low-queuecompute-geozones-metricssend-frequency-remindercompute-site-metricspurge-harvestersapigouvfr-load-apiscount-tagspurge-organizationsupdate-metricspurge-reuses
Request
const response = await fetch('//www.data.gouv.fr/api/1/workers/jobs/{id}', {
    method: 'GET',
    headers: {},
});
const data = await response.json();
Response
{
  "args": [],
  "crontab": {
    "day_of_month": "*",
    "day_of_week": "*",
    "hour": "*",
    "minute": "*",
    "month_of_year": "*"
  },
  "description": "text",
  "enabled": false,
  "id": "text",
  "interval": {
    "period": "days"
  },
  "last_run_at": "2024-09-20T06:13:44.809Z",
  "last_run_id": "text",
  "name": "text",
  "schedule": "text",
  "task": "test-high-queue"
}

Update a single scheduled job

PUT//www.data.gouv.fr/api/1/workers/jobs/{id}
Path parameters
id*string

A job ID

Header parameters
Response

Success

Body
argsarray of object

The job execution arguments

crontabCrontab (object)
descriptionstring

The job description

enabledboolean

Is this job enabled

idstring

The job unique identifier

intervalInterval (object)
kwargsobject

The job execution keyword arguments

last_run_atstring (date-time)

The last job execution date

last_run_idstring

The last execution task id

name*string

The job unique name

schedulestring

The schedule display

task*enum

The task name

Example: "test-high-queue"
test-high-queuetest-default-queueharvestupdate-datasets-reuses-metricspurge-harvest-jobspiwik-bulk-track-apitest-errormap-transport-datasetsrecommendations-cleantest-logcheck-integrityexport-csvrecommendations-addpurge-chunkspurge-datasetstest-low-queuecompute-geozones-metricssend-frequency-remindercompute-site-metricspurge-harvestersapigouvfr-load-apiscount-tagspurge-organizationsupdate-metricspurge-reuses
Request
const response = await fetch('//www.data.gouv.fr/api/1/workers/jobs/{id}', {
    method: 'PUT',
    headers: {},
});
const data = await response.json();
Response
{
  "args": [],
  "crontab": {
    "day_of_month": "*",
    "day_of_week": "*",
    "hour": "*",
    "minute": "*",
    "month_of_year": "*"
  },
  "description": "text",
  "enabled": false,
  "id": "text",
  "interval": {
    "period": "days"
  },
  "last_run_at": "2024-09-20T06:13:44.809Z",
  "last_run_id": "text",
  "name": "text",
  "schedule": "text",
  "task": "test-high-queue"
}

Delete a single scheduled job

DELETE//www.data.gouv.fr/api/1/workers/jobs/{id}
Path parameters
id*string

A job ID

Response

Successfuly deleted

Request
const response = await fetch('//www.data.gouv.fr/api/1/workers/jobs/{id}', {
    method: 'DELETE',
    headers: {},
});
const data = await response.json();

Get a tasks status given its ID

GET//www.data.gouv.fr/api/1/workers/tasks/{id}
Path parameters
id*string
Header parameters
Response

Success

Body
excstring

The exception thrown during execution

idstring

Tha task execution ID

resultstring

The task results if exists

statusenum

Cron expression for hour

Example: "PENDING"
PENDINGRETRYRECEIVEDSTARTEDFAILUREREVOKEDSUCCESS
tracebackstring

The execution traceback

Request
const response = await fetch('//www.data.gouv.fr/api/1/workers/tasks/{id}', {
    method: 'GET',
    headers: {},
});
const data = await response.json();
Response
{
  "exc": "text",
  "id": "text",
  "result": "text",
  "status": "PENDING",
  "traceback": "text"
}

Dernière mise à jour