MoySklad

Interact with MoySklad API v1.2

Overview

This node integrates with the MoySklad API v1.2 to manage various resources, including Customer Orders. Specifically, for the Customer Order - Get Many operation, it retrieves multiple customer order records from MoySklad with support for filtering, pagination, and expanding related entities.

Typical use cases include:

  • Fetching a list of customer orders for reporting or analysis.
  • Retrieving filtered subsets of orders based on custom criteria (e.g., orders with specific attributes).
  • Paginating through large sets of orders in batches.
  • Expanding related data such as linked counterparties or products within each order.

For example, a user might fetch all customer orders created in the last month, limit results to 100 per request, and expand related counterparty details to enrich the dataset.

Properties

Name Meaning
Additional Options A collection of optional parameters to customize the query:
- Expand Comma-separated relations to expand in the response (e.g., linked entities to include fully).
- Filters Semicolon-separated filters to narrow down results; supports custom fields like attributes.name=value.
- Limit Maximum number of records to return (between 1 and 1000). Defaults to 100.
- Offset Number of records to skip before starting to collect the result set. Defaults to 0.

Output

The output JSON contains a single field:

  • rows: An array of customer order objects retrieved from MoySklad. Each object represents one customer order with its properties as returned by the API, potentially including expanded related entities if requested.

No binary data is produced by this operation.

Example output structure:

{
  "rows": [
    {
      "id": "order-id-1",
      "name": "Order #1",
      "state": { /* order state info */ },
      "counterparty": { /* expanded counterparty info if requested */ },
      // other order fields...
    },
    {
      "id": "order-id-2",
      "name": "Order #2",
      // ...
    }
  ]
}

Dependencies

  • Requires an API token credential for MoySklad API authentication.
  • The node uses the Axios HTTP client internally to communicate with the MoySklad REST API at https://api.moysklad.ru/api/remap/1.2.
  • No additional external dependencies are needed beyond the configured API credentials.

Troubleshooting

  • Missing Credentials Error: If the API token is not provided or invalid, the node will throw an error indicating missing credentials. Ensure that a valid MoySklad API token is configured in n8n credentials.

  • HTTP Errors (Status >= 400): The node throws errors containing the HTTP status code and API response body when requests fail. Common causes include invalid filters, exceeding rate limits, or requesting non-existent resources. Review the error message and verify the input parameters.

  • Rate Limiting (HTTP 429): The node implements automatic retries with exponential backoff when receiving HTTP 429 responses. However, excessive requests may still cause failures. Reduce request frequency or increase offset/limit values to paginate more efficiently.

  • Invalid Filter Syntax: Filters must be semicolon-separated strings supporting custom fields. Incorrect syntax can lead to API errors. Validate filter expressions carefully.

Links and References

Discussion