MoySklad

Interact with MoySklad API v1.2

Overview

This node integrates with the MoySklad API v1.2 to manage supply-related data within the MoySklad system. Specifically, for the Supply - Create operation, it allows users to create new supply records by sending a raw JSON body that conforms to the MoySklad API specification.

Typical use cases include automating inventory supply entries, integrating external procurement systems with MoySklad, or programmatically adding supply documents based on business workflows. For example, a user might automate the creation of supply records when new stock arrives, ensuring real-time synchronization between warehouse management and accounting systems.

Properties

Name Meaning
Body Raw JSON body representing the supply data to be created, formatted according to the MoySklad API.
Additional Options Collection of optional parameters:
  Expand Comma-separated list of related entities to expand in the response (e.g., linked documents or metadata).
  Filters Semicolon-separated filters for querying, supporting custom fields (not typically used in create).
  Limit Maximum number of items to return (default 100, max 1000) — not applicable for create but available generally.
  Offset Number of items to skip before starting to collect the result set (default 0) — not applicable for create.

Note: For the Create operation, only the Body property is essential. The additional options are more relevant for retrieval operations but are still accepted by the node.

Output

The output is a JSON object representing the newly created supply entity as returned by the MoySklad API. This includes all details of the supply record such as its unique ID, attributes, linked documents, and metadata expanded if requested.

Example output structure (simplified):

{
  "id": "unique-supply-id",
  "name": "Supply Document Name",
  "moment": "2024-06-01T12:00:00Z",
  "positions": [
    {
      "assortment": { /* product details */ },
      "quantity": 10,
      "price": 100
    }
  ],
  "state": { /* status info */ },
  // ... other supply fields ...
}

The node does not output binary data.

Dependencies

  • Requires an API authentication token credential for MoySklad API access.
  • Uses Axios HTTP client internally to communicate with the MoySklad REST API at https://api.moysklad.ru/api/remap/1.2.
  • The node expects the user to provide valid JSON in the Body property matching the MoySklad API schema for supplies.

Troubleshooting

  • Missing Credentials Error: If the API token is not configured or invalid, the node will throw an error indicating missing credentials. Ensure the API key/token is correctly set up in n8n credentials.
  • Invalid JSON Body: Providing malformed JSON in the Body property will cause parsing errors or API rejections. Validate JSON syntax before execution.
  • MoySklad API Errors: The node surfaces HTTP errors from the API with messages like MoySklad error <status>: <response>. Common issues include:
    • 400 Bad Request: Likely due to invalid or incomplete JSON data.
    • 401 Unauthorized: Invalid or expired API token.
    • 429 Too Many Requests: Rate limiting; the node retries with exponential backoff but may fail after multiple attempts.
  • Timeouts: Network issues or slow responses can cause timeouts (60 seconds default). Check network connectivity and API availability.

Links and References

Discussion