api.routes.internal.scripts¶
Attributes¶
Functions¶
List every registered script by name (see |
|
|
Queue a run of the named script. |
|
A page of this script's recorded runs, newest first ( |
|
Every live stage of an in-progress run of this script, for polling while |
|
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, forupdate_product, an Airtable Variation id (its default entry point – exactly one ofrecord_id/model_idis required for that script, not both).model_id –
update_productonly – 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;offsetto page further back).totalis how many runs are currently stored in total (up toRunStore.MAX_RUNS_PER_SCRIPT) – anoffset + len(runs) < totalcaller 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’sreport_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.