Actions72
- Bài Viết Actions
- Blog Actions
- Bộ Sưu Tập Actions
- Khách Hàng Actions
- Đơn Hàng Actions
- Trang Actions
- Sản Phẩm Actions
- Biến Thể Sản Phẩm Actions
Bộ Sưu Tập → Cập Nhật
AI-generatedOverview
This node manages custom metafields on various resource types within the Sapo platform. Metafields are additional data fields that can be attached to resources like collections, products, customers, orders, and more, allowing users to extend the default data model with custom information.
The "Cập Nhật" (Update) operation specifically updates an existing metafield for a given resource by its ID. This is useful when you want to modify metadata such as inventory locations, custom tags, or any other extended attributes without altering the core resource data.
Practical example:
You have a collection ("Bộ Sưu Tập") with a metafield storing warehouse location info. If the storage location changes, you can use this node's update operation to change the warehouse_location value in the metafield accordingly.
Properties
| Name | Meaning |
|---|---|
| ID Tài Nguyên | The unique numeric identifier of the resource (e.g., collection) whose metafield you want to update. |
| ID Trường Tùy Chỉnh | The unique numeric identifier of the metafield to update. |
| Dữ Liệu Trường Tùy Chỉnh | JSON object containing the metafield data to update. It includes: - namespace: grouping namespace for the metafield (e.g., "inventory")- key: the key name of the metafield (e.g., "warehouse_location")- value: the new value to set (e.g., "A-12")- value_type: type of the value (e.g., "string")- description: description of the metafield purpose |
Output
The output is a JSON object representing the updated metafield returned from the Sapo API. It contains all relevant details of the metafield after the update, including its identifiers, namespace, key, value, value type, and description.
Example output structure (simplified):
{
"id": 123,
"namespace": "inventory",
"key": "warehouse_location",
"value": "A-12",
"value_type": "string",
"description": "Storage location in warehouse",
"owner_type": "collection",
"owner_id": 456
}
No binary data is output by this node.
Dependencies
- Requires an active connection to the Sapo platform via an API key credential.
- The node depends on the internal
SapoApiBaseclass to interact with the Sapo API endpoints for metafields. - Proper permissions on the Sapo account to read and update metafields on the specified resource.
Troubleshooting
Common issues:
- Invalid or missing resource ID or metafield ID will cause errors.
- Incorrectly formatted JSON in the "Dữ Liệu Trường Tùy Chỉnh" property may lead to parsing or validation failures.
- Insufficient API permissions or expired credentials can result in authentication errors.
- Trying to update a metafield that does not exist will return an error.
Error messages:
"Resource not found": Check if the resource ID and metafield ID are correct."Invalid JSON data": Verify the JSON structure and required fields in the metafield data."Authentication failed": Ensure the API key credential is valid and has necessary access rights.
To handle errors gracefully, enable "Continue On Fail" in the node settings to capture error messages in the output instead of stopping execution.
Links and References
- Sapo API Documentation - Metafields (example link, replace with actual if available)
- n8n Documentation on Creating Custom Nodes
- General info on Metafields Concept (similar concept used by many e-commerce platforms)