MoySklad

Interact with MoySklad API v1.2

Overview

This node integrates with the MoySklad API v1.2 to manage Customer Orders, specifically allowing users to update the status of a Customer Order. It is useful in scenarios where you need to programmatically change the state of an order within MoySklad, such as marking an order as processed, shipped, or cancelled.

A practical example would be automating order workflows: after receiving payment confirmation, the node can update the order status to "Paid" or "Completed" without manual intervention.

Properties

Name Meaning
ID The unique identifier of the Customer Order to update.
Body Raw JSON body containing the new status and any other fields as per the MoySklad API specification for updating status.
Additional Options A collection of optional parameters:
- Expand: Comma-separated relations to expand in the response.
- Filters: Semicolon-separated filters supporting custom fields (e.g., attributes.name=value).
- Limit: Number limiting the number of results (default 100).
- Offset: Number offsetting the start of results (default 0).

Output

The node outputs a JSON object representing the updated Customer Order as returned by the MoySklad API after the status update. This includes all fields of the order, reflecting the new status and any other changes made.

No binary data output is produced by this operation.

Example output structure (simplified):

{
  "id": "order-id",
  "name": "Order #1234",
  "state": {
    "meta": {
      "href": "https://api.moysklad.ru/api/remap/1.2/entity/customerorder/metadata/states/state-id",
      "type": "state",
      "mediaType": "application/json"
    }
  },
  // ... other order fields ...
}

Dependencies

  • Requires an API token credential for MoySklad API authentication.
  • The node uses Axios HTTP client internally to communicate with the MoySklad REST API at https://api.moysklad.ru/api/remap/1.2.
  • Network connectivity to MoySklad API endpoint is necessary.
  • No additional environment variables are required beyond the API token credential.

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 from MoySklad API: The node throws errors if the API responds with status codes 400 or above, including detailed messages from the API. Common causes include:

    • Invalid order ID.
    • Malformed JSON in the Body property.
    • Insufficient permissions for the API token.

    To resolve, verify the correctness of the ID, ensure the JSON body matches the API schema, and confirm the API token has appropriate access rights.

  • Rate Limiting: The node implements retry logic on HTTP 429 responses with exponential backoff. However, excessive requests may still cause delays or failures. Reduce request frequency or optimize workflow triggers if rate limits are hit frequently.

Links and References

Discussion