Tiny ERP icon

Tiny ERP

Interact with Tiny ERP API to manage products, orders, and users. Use this tool when you need to retrieve or manage ERP data.

Overview

The Update Stock Batch operation in the Products resource allows users to update stock quantities for multiple products in a single batch request. This is particularly useful for inventory management scenarios where stock levels need to be adjusted for many items at once, such as after receiving a shipment, conducting a stocktake, or processing multiple sales returns.

Typical use cases include:

  • Bulk updating stock quantities after a warehouse inventory count.
  • Adjusting stock levels for multiple products following a supplier delivery.
  • Processing batch stock corrections due to discrepancies or errors.

By batching updates (up to 20 per batch), this operation optimizes API calls and reduces overhead compared to updating each product's stock individually.

Properties

Name Meaning
Stock Updates Data A JSON array of stock update objects to process in batch. Each object should specify product ID, quantity change, movement type, and optionally the warehouse/deposit. Maximum 20 updates per batch. Example format:
json<br>[<br> {<br> "idProduto": "12345888",<br> "quantidade": 10,<br> "tipo": "E",<br> "idDeposito": "123456"<br> },<br> {<br> "idProduto": "12345889",<br> "quantidade": -5,<br> "tipo": "S",<br> "deposito": "deposito central"<br> }<br>]<br>
Batch Size Number of stock updates to process per batch. Must be between 1 and 20. Controls how many updates are sent in one API call.
Default Date The default date/time to assign to stock movements if individual updates do not specify a date. Format example: 2024-01-15 14:30:00.

Output

The node outputs an array of JSON objects representing the results of the batch stock update operation. Each output item corresponds to the response from the ERP system for the processed batch of stock updates.

  • The json field contains details about the success or failure of each stock update within the batch.
  • If any error occurs during processing, the output may include an error field with the error message, along with the resource and operation names.
  • The node does not output binary data.

Dependencies

  • Requires an API key credential for authenticating with the Tiny ERP API.
  • The node depends on the external Tiny ERP service to perform stock updates.
  • Proper configuration of the API credentials in n8n is necessary for successful execution.

Troubleshooting

  • Batch size limits: Ensure that the batch size does not exceed 20 updates per batch; otherwise, the API may reject the request.
  • Invalid stock update objects: Each stock update must include required fields like product ID (idProduto), quantity (quantidade), and movement type (tipo). Missing or malformed fields can cause errors.
  • Date formatting: If specifying a default date, ensure it follows the expected datetime format; otherwise, the API might reject the input.
  • API authentication errors: Verify that the API key credential is valid and has sufficient permissions.
  • Error messages: If the node outputs an error message, check the message content for clues—common issues include invalid product IDs, unauthorized access, or exceeding rate limits.
  • Use the node’s “Continue On Fail” option to handle partial failures gracefully when processing multiple batches.

Links and References

Discussion