MoySklad

Interact with MoySklad API v1.2

Overview

This node integrates with the MoySklad API v1.2 to manage product data within the MoySklad inventory system. Specifically, the Update Product operation allows users to modify existing product records by specifying the product ID and providing updated data in JSON format.

Common scenarios for this node include:

  • Synchronizing product information from an external system into MoySklad.
  • Automating updates to product details such as price, description, or stock levels.
  • Bulk updating multiple products by looping over input items.

For example, a user might update the price and description of a product by providing its ID and a JSON body containing the new values.

Properties

Name Meaning
ID The unique identifier of the product to update.
Body Raw JSON object representing the fields to update on the product, following the MoySklad API schema.
Additional Options Optional parameters to customize the request:
- Expand Comma-separated list of related entities to expand in the response.
- Filters Semicolon-separated filters to apply when querying (not typically used in update).
- Limit Maximum number of items to return (used mainly in get/getAll operations).
- Offset Number of items to skip before starting to collect the result set (used mainly in get/getAll operations).

Output

The output is a JSON object representing the updated product as returned by the MoySklad API after a successful update operation. It contains all the product fields including any expanded relations if requested.

Example output structure (simplified):

{
  "id": "product-id",
  "name": "Updated Product Name",
  "code": "SKU123",
  "description": "Updated description",
  "price": 100.0,
  "stock": 50,
  // ... other product fields ...
}

No binary data is produced by this node.

Dependencies

  • Requires an API token credential for authenticating with the MoySklad API.
  • Uses the Axios HTTP client internally to make REST API calls.
  • The node expects the MoySklad API base URL https://api.moysklad.ru/api/remap/1.2.
  • Network connectivity to the MoySklad API endpoint is required.

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 API token is configured in n8n credentials.

  • HTTP Errors from MoySklad API: The node throws errors with status codes and messages returned by the API. Common issues include:

    • 400 Bad Request: Invalid JSON body or malformed request.
    • 401 Unauthorized: Invalid or expired API token.
    • 404 Not Found: Product ID does not exist.
    • 429 Too Many Requests: Rate limiting; the node retries with exponential backoff but may fail after several attempts.
  • JSON Parsing Errors: The "Body" property must be valid JSON. Malformed JSON will cause parsing errors before sending the request.

  • Timeouts: The node uses a 60-second timeout for API requests. Long-running requests may time out.

To resolve these issues:

  • Verify API token validity.
  • Check the correctness of the JSON body.
  • Confirm the product ID exists in MoySklad.
  • Handle rate limits by reducing request frequency.

Links and References

Discussion