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
Sản Phẩm → Tạo Mới
AI-generatedOverview
This node manages custom metafields on various resources within the Sapo platform, such as products, customers, orders, and more. Specifically, for the "Sản Phẩm" (Product) resource with the "Tạo Mới" (Create) operation, it allows users to create new custom metafields associated with a product by specifying details like namespace, key, value, and description.
Common scenarios include:
- Adding additional metadata to products that are not covered by default fields, such as warehouse location, supplier codes, or internal notes.
- Extending product information dynamically without modifying the core product schema.
- Integrating with external systems that require custom attributes on products.
Practical example:
- A warehouse manager wants to tag each product with its storage location inside the warehouse. Using this node, they can create a metafield with namespace "inventory", key "warehouse_location", and value indicating the exact shelf or bin (e.g., "A-12").
Properties
| Name | Meaning |
|---|---|
| ID Tài Nguyên | The numeric ID of the product resource to which the metafield will be attached. |
| Dữ Liệu Trường Tùy Chỉnh | JSON object defining the metafield data to create. Includes: - namespace: grouping category (e.g., "inventory")- key: identifier for the metafield (e.g., "warehouse_location")- value: the actual value stored (e.g., "A-12")- value_type: data type of the value (e.g., "string")- description: human-readable explanation of the metafield's purpose |
Output
The node outputs an array with one item containing a json field representing the created metafield object returned from the Sapo API. This object includes all details of the newly created metafield, such as its ID, namespace, key, value, value type, description, and association to the product.
No binary data is output by this node.
Example output snippet (simplified):
{
"id": 12345,
"namespace": "inventory",
"key": "warehouse_location",
"value": "A-12",
"value_type": "string",
"description": "Storage location in warehouse",
"owner_type": "product",
"owner_id": 67890
}
Dependencies
- Requires an active connection to the Sapo API via an API authentication credential configured in n8n.
- The node depends on the bundled
SapoApiBaseclass to handle API requests related to metafields. - Proper permissions on the Sapo account to create metafields on products are necessary.
Troubleshooting
Common issues:
- Invalid or missing product ID (
resourceId) will cause the API call to fail. - Malformed JSON in the
dataproperty may result in errors when sending the request. - Insufficient permissions or invalid API credentials will lead to authentication errors.
- Invalid or missing product ID (
Error messages:
"error": "Resource not found": Check if the product ID exists and is correct."error": "Invalid metafield data": Verify the JSON structure and required fields (namespace,key,value,value_type).- Authentication failures: Ensure the API key credential is valid and has access rights.
To resolve errors, verify input parameters, ensure proper JSON formatting, and confirm API credentials and permissions.
Links and References
- Sapo API Documentation - Metafields
- n8n Documentation - Creating Custom Nodes
- JSON Schema Reference (for structuring the
dataJSON property)