Distru icon

Distru

Interact with the Distru API

Overview

The node interacts with the Distru API to retrieve or manipulate various resources related to inventory, orders, products, packages, and more. Specifically, the "Get Package" operation fetches package data from Distru, optionally filtered by criteria such as creation date, license number, location IDs, status, and update date. This node is useful for automating workflows that require access to detailed package information within a cannabis distribution or inventory management context.

Practical examples include:

  • Retrieving all active packages at specific locations for reporting.
  • Filtering packages created or updated within a certain timeframe.
  • Integrating package data into other systems for compliance or sales analysis.

Properties

Name Meaning
Inserted Datetime Filter packages by their creation datetime (ISO 8601 format, e.g., 2022-07-10T00:00:00Z).
License Number Filter packages by license number.
Location IDs A list of location UUIDs to filter packages by. Multiple values can be added.
Status Filter packages by their status. Possible values: Active, Finished, Inactive, Selling, Sold, Transferred.
Updated Datetime Filter packages by the datetime they were most recently modified (ISO 8601 format).
Page Number Page of results to return for pagination (default is 1).
Page Size Number of results per page for pagination (default is 100).

Output

The output is an array of JSON objects representing package data retrieved from the Distru API. Each item contains the full package details as returned by the API under the json field.

Example structure of one output item:

{
  "json": {
    "id": "package-uuid",
    "status": "active",
    "license_number": "12345",
    "location_ids": ["location-uuid1", "location-uuid2"],
    "inserted_datetime": "2022-07-10T00:00:00Z",
    "updated_datetime": "2022-07-15T12:00:00Z",
    // ... other package-specific fields ...
  }
}

The node does not output binary data.

Dependencies

  • Requires an API token credential for authenticating requests to the Distru API.
  • The base URL for API requests depends on whether staging mode is enabled in credentials:
    • Production: https://app.distru.com/public/v1
    • Staging: https://staging.distru.com/public/v1
  • No additional external dependencies are required beyond standard HTTP request capabilities provided by n8n.

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 the API key credential is configured properly.
  • Invalid Filters: Providing invalid UUID formats or incorrect date strings may cause the API to reject the request or return no results.
  • Pagination Limits: Large page sizes or high page numbers might result in empty responses if out of range.
  • API Errors: Network issues or API downtime will cause request failures. The node supports continuing on failure if enabled, returning error messages in the output JSON.

Links and References

Discussion