Distru icon

Distru

Interact with the Distru API

Overview

The "Upsert Product" operation in this node allows you to create a new product or update an existing product in the Distru system via its API. This operation is useful for managing product catalogs programmatically, enabling automation of inventory updates, product details synchronization, and integration with other systems such as e-commerce platforms or ERP solutions.

Typical use cases include:

  • Adding new products to your inventory management system.
  • Updating existing product information like pricing, descriptions, categories, or inventory tracking methods.
  • Automating product data synchronization between Distru and other business tools.

For example, you can use this node to update the unit price and description of a product whenever there is a change in your pricing strategy or product details.

Properties

Name Meaning
Product ID Optional unique identifier of the product to update. Leave empty to create a new product.
Name The name of the product (required).
SKU Stock Keeping Unit identifier for the product.
Description Textual description of the product.
Inventory Tracking Method Method used to track inventory: PACKAGE, PRODUCT, or BATCH.
Category ID Identifier for the product's category.
Subcategory ID Identifier for the product's subcategory.
Group ID Identifier for the product group.
Brand ID Identifier for the brand associated with the product.
Vendor ID Identifier for the vendor supplying the product.
Unit Price Selling price per unit of the product.
Unit Cost Cost price per unit of the product.
MSRP Manufacturer's Suggested Retail Price.
Wholesale Unit Price Wholesale price per unit.
UPC Universal Product Code barcode value.
Units per Case Number of units contained in one case.
Is Featured Boolean flag indicating if the product is featured.
Is Inactive Boolean flag indicating if the product is inactive.
Menu Visibility Controls product visibility in menus: INCLUDE_IN_ALL, INCLUDE_IN_SELECT, or NONE.
Menus List of menu identifiers where the product should appear.
Tags List of tags associated with the product.
Total THC Total THC content amount.
Total CBD Total CBD content amount.
Total Cannabinoid Unit Unit type for cannabinoid totals: PERCENT, MG_PER_SERVING, or MG_PER_CONTAINER.
Unit Type ID Identifier for the unit type (e.g., grams, ounces).
Unit Net Weight Net weight of one unit.
Unit Serving Size Serving size amount per unit.
Unit Net Weight and Serving Size Unit Type ID Identifier for the unit type used for net weight and serving size.
Strain ID Identifier for the strain associated with the product.
Owner ID Identifier for the owner of the product record.

Output

The output of the "Upsert Product" operation is a JSON object representing the created or updated product as returned by the Distru API. This includes all product fields such as IDs, names, pricing, inventory tracking method, categories, tags, cannabinoid content, and other metadata.

No binary data is output by this operation.

Example output structure (simplified):

{
  "id": "product-uuid",
  "name": "Product Name",
  "sku": "SKU123",
  "description": "Product description",
  "inventory_tracking_method": "PACKAGE",
  "category_id": "category-uuid",
  "unit_price": 10.5,
  "is_featured": false,
  "tags": ["tag1", "tag2"],
  ...
}

Dependencies

  • Requires an API token credential for authenticating with the Distru API.
  • The node uses the Distru REST API endpoint, either production or staging based on configuration.
  • No additional external dependencies are required beyond the API access.

Troubleshooting

  • Missing API Token: If the API token is not set in credentials, the node will throw an error "Distru API token is not set!". Ensure that the API key credential is configured properly.
  • Invalid Product ID Format: Product IDs are converted to UUID format internally. Providing invalid IDs may cause errors.
  • API Errors: Any errors returned from the Distru API (e.g., validation errors, permission issues) will be surfaced as node execution errors.
  • Required Fields Missing: The "Name" property is required; omitting it will cause the request to fail.
  • Network Issues: Connectivity problems to the Distru API endpoint will result in request failures.

To resolve errors:

  • Verify API token validity and permissions.
  • Check that required properties are provided and correctly formatted.
  • Review API response messages for specific validation issues.
  • Confirm network connectivity to Distru endpoints.

Links and References

Discussion