Distru icon

Distru

Interact with the Distru Public API v1

Actions35

Purchases → Upsert

AI-generated

Overview

This node operation allows users to create or update purchase records in the Distru system. It is useful for managing supplier purchases by specifying company details, purchase items, charges, and relevant dates. For example, a user can upsert a purchase by providing the supplier company ID, a list of purchased items with quantities and prices, and any additional charges or discounts associated with the purchase.

Use Case Examples

  1. Creating a new purchase order for a supplier with multiple items and charges.
  2. Updating an existing purchase record by specifying its purchase ID and modifying the items or charges.

Properties

Name Meaning
Company ID Supplier company ID, required for creating a purchase.
Additional Fields Optional fields such as Purchase ID (for update), Order date, and Due date to provide more details about the purchase.
Items List of items included in the purchase, each with product ID, quantity, price per unit, location ID, and batch ID.
Charges List of charges related to the purchase, including charge name, type (charge, discount, tax), flat price amount, and percentage amount.

Output

JSON

  • json
    • success - Indicates successful operation when no data is returned.
    • data - Contains the purchase data returned from the API after upsert operation.
    • error - Error message if the operation fails and continueOnFail is enabled.

Dependencies

  • Requires an API token credential for the Distru API.

Troubleshooting

  • Error if the API token is not set: Ensure the Distru API token credential is configured correctly.
  • Missing Resource ID error if updating a purchase without providing the purchase ID: Provide the purchase ID in Additional Fields when updating.
  • Missing binary data error if uploading files without the specified binary property: Ensure the binary property name is correct and data is present.

Discussion