MoySklad

Interact with MoySklad API v1.2

Overview

This node integrates with the MoySklad API v1.2, enabling users to perform various operations on different resources such as products, customer orders, counterparties, supplies, and demands. It supports common CRUD (Create, Read, Update, Delete) operations along with status updates and bulk retrieval of records.

Typical use cases include:

  • Fetching product or order data for inventory or sales automation.
  • Creating or updating entities like customer orders or supplies based on external triggers.
  • Deleting obsolete records in MoySklad.
  • Applying filters and pagination to retrieve specific subsets of data efficiently.

For example, a user could automate syncing new customer orders from an e-commerce platform into MoySklad by creating orders via this node, or regularly fetch updated product lists with filtering and expansion of related entities.

Properties

Name Meaning
Additional Options A collection of optional parameters to refine API requests:
- Expand Comma-separated list of relations to expand in the response (e.g., linked entities).
- Filters Semicolon-separated filters to narrow down results; supports custom fields (e.g., attributes.name=value).
- Limit Maximum number of records to return per request (1 to 1000).
- Offset Number of records to skip before starting to collect the result set (for pagination).

Note: The node also internally uses these parameters:

  • Resource: The type of entity to operate on (e.g., product, customer order).
  • Operation: The action to perform (create, update, delete, get, getAll, updateStatus).
  • ID: Identifier of the specific resource item (required for some operations).
  • Body: Raw JSON string representing the payload for create, update, or updateStatus operations.

Output

The node outputs JSON data structured according to the operation performed:

  • For getAll operation:

    {
      "rows": [ /* array of resource objects retrieved from MoySklad */ ]
    }
    

    This contains an array of entities matching the query, including applied filters, expansions, limits, and offsets.

  • For get, create, update, and updateStatus operations:
    The output is the JSON object returned by the MoySklad API representing the single resource item affected.

  • For delete operation:

    {
      "success": true,
      "id": "<deleted_resource_id>"
    }
    

    Indicates successful deletion of the specified resource.

The node does not output binary data.

Dependencies

  • Requires an API token credential for authenticating with the MoySklad API.
  • Uses the Axios HTTP client library internally to make REST API calls.
  • The base URL for API requests is fixed to https://api.moysklad.ru/api/remap/1.2.
  • The node expects the API token to be provided via n8n credentials configured by the user.

Troubleshooting

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

  • HTTP Errors from MoySklad API:
    Any HTTP status code >= 400 returned by the API will cause the node to throw an error with the status code and response body. Common causes include invalid IDs, malformed JSON bodies, or insufficient permissions. Review the error message and verify the input parameters and API token scopes.

  • Rate Limiting (HTTP 429):
    The node implements automatic retries with exponential backoff when receiving HTTP 429 responses. However, if rate limits persist beyond several retries, consider reducing request frequency or increasing limits where possible.

  • JSON Parsing Errors:
    For create, update, and updateStatus operations, the node expects the body parameter to be valid JSON. Invalid JSON strings will cause parsing errors. Validate JSON syntax before running the workflow.

Links and References

Discussion