VitePOS Bridge icon

VitePOS Bridge

Use VitePOS automation bridge and analytics APIs

Batch → Update Batch

AI-generated

Summary

Updates an existing VitePOS batch (stock lot) by sending a PATCH to the bridge endpoint /wp-json/vtab/v1/batches/{batchId}. The body is built from the Batch Fields collection or from raw JSON.

Inputs

  • Batch ID (required) — ID of the batch to update. It is inserted into the request URL path.
  • Input Mode — 'Use Fields' (default) builds the body from Batch Fields. 'Advanced JSON' sends the JSON Body as-is.
  • Batch Fields — Collection used in Use Fields mode. Only fields you add are sent. Options: batch_id, batch_no, expiry_date, is_archived (Y/N), outlet_id, product_id, purchase_id, purchase_item_id, purchase_price, sale_price, received_qty, remaining_qty, sold_qty, warehouse_id, and dry_run. Dry Run adds dry_run:true to the body and is only sent when enabled.
  • JSON Body — Used in Advanced JSON mode. Custom request body sent as the PATCH payload (default {"dry_run": true}). Invalid JSON raises an error.

Output shape

One item per input item, containing the bridge API's JSON response with a 'response' text summary field added at the top.

The summary for this operation is generic ('Batch request completed.'), or the API's message if the API returns status/success false. If the API response already has a 'response' key, the original is returned under 'raw'. With Continue On Fail enabled, failed items return {error: message}. Because the request body is only sent when it is non-empty, empty Batch Fields send no body. The expiry_date is sent as the full date-time string, not truncated.

Examples

Example 1: Correct the expiry date and remaining quantity of a batch

Resource: Batch, Operation: Update Batch, Batch ID: 123, Input Mode: Use Fields, Batch Fields: Expiry Date and Remaining Quantity set.

Example 2: Preview an update without saving it

Batch ID: 123, Batch Fields: Sale Price = 9.5, Dry Run = true.

Example 3: Archive a batch with a custom payload

Input Mode: Advanced JSON, JSON Body: {"is_archived":"Y"}, Batch ID: 123.

Links

Discussion