Sapo Trường Tùy Chỉnh icon

Sapo Trường Tùy Chỉnh

Quản lý trường tùy chỉnh trên Sapo

Sản Phẩm → Cập Nhật

AI-generated

Overview

This node manages custom metafields on various resources within the Sapo platform, such as products, articles, customers, orders, and more. Specifically, for the Sản Phẩm (Product) resource with the Cập Nhật (Update) operation, it updates an existing custom metafield associated with a product.

Typical use cases include:

  • Modifying metadata related to inventory, warehouse location, or other custom attributes of a product.
  • Keeping product-related custom data up-to-date without manually editing each product in the Sapo admin interface.
  • Automating updates to product metadata as part of larger workflows, e.g., syncing external inventory systems.

Example: Updating a product’s warehouse location stored in a metafield to reflect a new storage area.

Properties

Name Meaning
ID Tài Nguyên The unique numeric identifier of the product resource whose metafield is being updated.
ID Trường Tùy Chỉnh The unique numeric identifier of the specific metafield to update on the product.
Dữ Liệu Trường Tùy Chỉnh JSON object containing the metafield data to update. Includes fields like namespace, key, value, value_type, and description.

The Dữ Liệu Trường Tùy Chỉnh property expects a JSON structure similar to:

{
  "namespace": "inventory",
  "key": "warehouse_location",
  "value": "A-12",
  "value_type": "string",
  "description": "Storage location in warehouse"
}

Output

The node outputs a single JSON object representing the updated metafield data returned from the Sapo API after the update operation. This includes all relevant metafield properties reflecting the new state.

Output example structure:

{
  "id": 12345,
  "namespace": "inventory",
  "key": "warehouse_location",
  "value": "A-12",
  "value_type": "string",
  "description": "Storage location in warehouse",
  "owner_id": 67890,
  "owner_type": "product"
}

No binary data output is produced by this node.

Dependencies

  • Requires an active connection to the Sapo API via an API key credential configured in n8n.
  • The node depends on the internal SapoApiBase class to handle API requests to manage metafields.
  • Proper permissions on the Sapo account to read and update product metafields are necessary.

Troubleshooting

  • Common issues:

    • Invalid or missing product ID (resourceId) or metafield ID (metafieldId) will cause errors.
    • Malformed JSON in the data property can lead to request failures.
    • Insufficient API permissions or expired credentials may result in authentication errors.
    • Attempting to update a metafield that does not exist will return an error.
  • Error messages:

    • "error": "Metafield not found" — Check that the metafieldId corresponds to an existing metafield on the specified product.
    • "error": "Invalid JSON data" — Verify the JSON structure provided in the data property.
    • Authentication errors — Ensure the API key credential is valid and has required scopes.
  • To resolve errors, verify input parameters, ensure correct JSON formatting, and confirm API credentials and permissions.

Links and References

Discussion