Skip to content

ffl_integrations.distributor.hub

Source: apps/ffl_integrations/ffl_integrations/distributor/hub.py · 5 endpoint(s)

Generated by make api-docs — do not edit by hand.

overview

POST /api/method/ffl_integrations.distributor.hub.overview

Auth (derived from code): Roles: System Manager / Purchase Manager / Purchase User / Stock Manager

Everything the distributor-hub page renders, in one round trip.

Heartbeats are guarded per provider — a dead catalog service greys that provider's health line instead of blanking the page.

Returns: {distributors: [per-house rows with flags/priority/health and summary: [{label, value, tab}]], providers: [{code, settings_doctype, used_by}], can_write, catalog_local: {local, worker_running, warning}, can_sync_now (Local catalog and System Manager), capabilities: {catalog} (the data_service capability the page shows)}, and per row catalog_lanes (Local catalog only, else null): {lanes: [{lane, last_success_at, rows, last_status, error_class}], offers_total, offers_active}. A house whose catalog reads are off (its own service, else the site's) has health {catalog_off: true} instead of a probe.

Permissions: Hub read roles.

apps/ffl_integrations/ffl_integrations/distributor/hub.py:41

reorder

POST /api/method/ffl_integrations.distributor.hub.reorder

Auth (derived from code): Roles: System Manager / Purchase Manager

Persist a FULL permutation of distributor names as priorities 1..N.

Partial lists are rejected — a missing row would silently keep a stale priority that may collide with the new ones.

arg type required default description
names — yes — Every Distributor name exactly once, in the new order — list or JSON string.

Returns: {"order": names}.

Permissions: Hub write roles.

apps/ffl_integrations/ffl_integrations/distributor/hub.py:193

sync_now

POST /api/method/ffl_integrations.distributor.hub.sync_now

Auth (derived from code): Roles: System Manager

Queue every lane of one house's local catalog now (the hub's Sync now).

Each lane's schedule is skipped; no guard is: a short, truncated or shrunk feed file is refused as on a scheduled run.

arg type required default description
distributor string yes — Distributor name.

Returns: {enqueued: [lane sources], deduplicated: [lane sources already queued or running], worker_running}.

apps/ffl_integrations/ffl_integrations/distributor/hub.py:248

test_connection

POST /api/method/ffl_integrations.distributor.hub.test_connection

Auth (derived from code): Roles: System Manager / Purchase Manager / Purchase User / Stock Manager

Run the provider's live connection probe for one distributor.

Read-role gated: it is a diagnostic with no order-side effects (providers keep probes read-only).

arg type required default description
distributor string yes — Distributor name.

Returns: The provider's connection_test() result.

Permissions: Hub read roles.

apps/ffl_integrations/ffl_integrations/distributor/hub.py:225

toggle_flag

POST /api/method/ffl_integrations.distributor.hub.toggle_flag

Auth (derived from code): Roles: System Manager / Purchase Manager

Flip one routing flag on one distributor.

Doc-level write permission enforced on top of the role gate (a Purchase Manager without a doc share still passes — doctype perms grant write — but User Permissions are honoured).

arg type required default description
distributor string yes — Distributor name.
flag string yes — One of the hub's togglable flags (others are refused).
value — yes — Truthy/falsy.

Returns: {name, flag, value: 0|1}.

Permissions: Hub write roles + doc-level write check.

apps/ffl_integrations/ffl_integrations/distributor/hub.py:165