Start Custom Ingredient Latest Version Scan
Start a background scan that lists the organization's recipes that are not on the latest version of this custom ingredient. The scan compares the version each recipe uses now with the version that is current when the scan starts, and changes no recipe, ingredient or label.
Returns the job at once (queued). Read it with getJob until its state is succeeded, partially_succeeded or failed. A succeeded item is one recipe that is not on the latest version: subject_ref holds the recipe id, name and status, pinned_version_id, current_version_id, and label_affecting_fields. label_affecting is true when a field that may change a label differs. It does not mean the recipe's label changes, because that depends on the amount used. label_affecting_fields_known: false means the older version could not be read, so a person should check the recipe. A skipped item gives its reason in detail, for example pinned_newer_than_scan for a recipe moved to a version made after the scan started. A recipe already on the latest version gives no item.
result has as_of, the moment the scan started, and the counts recipes_scanned, recipes_behind, recipes_behind_label_affecting and recipes_behind_unreadable. recipes_behind at 0 means every active recipe is on the latest version. Any ingredient status can be scanned. The job fails with subject_not_found if the ingredient is deleted while it runs.
The scan covers each active recipe as it is now, read from a near-real-time index, so a recipe saved a moment ago may not be counted yet. An archived or deleted recipe is not scanned, and an archived recipe that is unarchived while still on an older version appears in the next scan. It does not look at earlier versions of a recipe, so it cannot say whether a label that was already issued needs reissuing. It scans one ingredient at a time and does not run by itself when a new version is confirmed. An organization runs at most 5 jobs at a time.
custom_ingredient_id*Custom Ingredient IdIdempotency-Key?|Any string you choose, up to 255 characters. Send the same key again for the same ingredient within 7 days to get back the scan it started, in whatever state it is now, instead of starting another. To run a new scan, send a new key.
The Idempotency-Key was already used for this ingredient: the job it started, in its current state.
application/json- response
Response for an endpoint that starts a job: the job, without items.
data*One job, without its items.
meta*Response metadata.
curl -X POST 'https://api.bettermenu.live/studio/custom-ingredients/string/latest-version-scans'{ "data": { "id": "string", "kind": "custom_ingredient.latest_version_scan", "subject": { "type": "custom_ingredient", "id": "string" }, "state": "queued", "stalled": true, "progress": { "total": 0, "done": 0, "failed": 0, "skipped": 0 }, "result": {}, "last_error": { "code": "string", "detail": "" }, "created_by": { "type": "string", "id": "string" }, "channel": "string", "created_at": "2019-08-24T14:15:22Z", "started_at": "2019-08-24T14:15:22Z", "heartbeat_at": "2019-08-24T14:15:22Z", "finished_at": "2019-08-24T14:15:22Z", "redrives": 0 }, "meta": { "version": "string", "request_id": "string", "timestamp": "string" }}