MoySklad

Interact with MoySklad API v1.2

Overview

This node integrates with the MoySklad API v1.2 to manage various resources, specifically here focusing on the Demand resource's Update Status operation. It allows users to update the status of a demand entity by sending a raw JSON body that conforms to the API's expected format.

Typical use cases include:

  • Automating order or demand status updates in inventory or sales workflows.
  • Synchronizing demand statuses between MoySklad and other systems.
  • Bulk updating demand statuses based on external triggers or conditions.

For example, you might use this node to mark a demand as "completed" or "cancelled" after processing it in your ERP system.

Properties

Name Meaning
ID The unique identifier of the Demand entity to update.
Body Raw JSON payload specifying the new status and any other fields as per the MoySklad API requirements.
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 (supports custom fields, e.g., attributes.name=value).
- Limit Maximum number of items to return (default 100, min 1, max 1000).
- Offset Number of items to skip before starting to collect the result set (default 0).

Output

The node outputs a JSON object representing the updated Demand entity as returned by the MoySklad API after the status update. This includes all fields of the demand, potentially expanded relations if requested.

Example output structure (simplified):

{
  "id": "string",
  "name": "string",
  "state": {
    "meta": {
      "href": "string",
      "type": "string",
      "mediaType": "application/json"
    }
  },
  // ... other demand fields ...
}

No binary data is produced by this operation.

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 the API token is correctly configured in n8n credentials.
  • MoySklad API Errors: The node surfaces errors from the API with status codes and messages. Common issues include:
    • 400 or 422 errors due to malformed JSON in the Body property or invalid status values.
    • 404 if the specified Demand ID does not exist.
    • 429 rate limiting errors are handled internally with retries, but excessive requests may still fail.
  • JSON Parsing Errors: The Body input must be valid JSON. Invalid JSON will cause parsing errors before the request is sent.
  • Timeouts: The node has a 60-second timeout; large or slow requests may time out.

To resolve errors:

  • Verify the Demand ID exists.
  • Validate the JSON body against MoySklad API documentation.
  • Check API token validity and permissions.
  • Use the Additional Options to limit or filter data if needed.

Links and References

Discussion