api.routes.internal.scripts

Attributes

Functions

list_scripts()

List every registered script by name (see api/scripts/registry.py).

run_script_endpoint(name[, record_id, model_id])

Queue a run of the named script.

script_runs(name[, limit, offset])

A page of this script's recorded runs, newest first (limit, default

script_current_stage(name)

Every live stage of an in-progress run of this script, for polling while

script_status(task_id)

Poll the status/result of a task queued by POST /scripts/{name}/run.

Module Contents

api.routes.internal.scripts.logger
api.routes.internal.scripts.router
async api.routes.internal.scripts.list_scripts()

List every registered script by name (see api/scripts/registry.py).

async api.routes.internal.scripts.run_script_endpoint(name: str, record_id: str | None = None, model_id: str | None = None)

Queue a run of the named script.

Parameters:
  • name – A registered script name (see GET /internal/scripts).

  • record_id – Required by create_product_shopify (an Airtable Model id – yes, confusingly, see the create-product guide on the documentation site) and, for update_product, an Airtable Variation id (its default entry point – exactly one of record_id/model_id is required for that script, not both).

  • model_id – update_product only – an Airtable Model id, updating every Variation of that Model in one go. Ignored by every other script.

Returns:

JSON avec task_id à utiliser sur GET /scripts/status/{task_id} ou GET /scripts/{name}/runs.

async api.routes.internal.scripts.script_runs(name: str, limit: int = 20, offset: int = 0)

A page of this script’s recorded runs, newest first (limit, default 20, max 100; offset to page further back). total is how many runs are currently stored in total (up to RunStore.MAX_RUNS_PER_SCRIPT) – an offset + len(runs) < total caller knows there’s more to fetch.

async api.routes.internal.scripts.script_current_stage(name: str)

Every live stage of an in-progress run of this script, for polling while it executes (see api/tasks.py’s report_stage). Empty when nothing is currently running. More than one entry when several runs are in flight at once for different record_ids – e.g. create_product_shopify’s bulk “create all missing” button.

async api.routes.internal.scripts.script_status(task_id: str)

Poll the status/result of a task queued by POST /scripts/{name}/run.

Returns:

JSON avec status (PENDING/STARTED/RETRY/SUCCESS/FAILURE) et, une fois terminé, result ou error.