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

Trang → Xác Thực

AI-generated

Overview

This node manages custom metafields on various resource types within the Sapo platform, such as articles, blogs, collections, customers, orders, pages, products, and product variants. It supports operations like creating, retrieving, updating, deleting, counting, bulk deleting, and validating metafields associated with a specific resource.

The "Xác Thực" (Validate) operation specifically checks whether a given value for a metafield is valid according to predefined rules or constraints. This can be useful when you want to verify data integrity before creating or updating metafields.

Practical examples:

  • Validating a metafield value before saving it to ensure it meets expected formats or types.
  • Checking if a string value intended for a metafield is acceptable by the system.
  • Automating validation in workflows that manage product metadata or customer attributes.

Properties

Name Meaning
ID Tài Nguyên The numeric ID of the resource (e.g., page, product) to which the metafield belongs.
Tùy Chọn Xác Thực JSON object specifying the validation data, including the type and value to validate.

Example of Tùy Chọn Xác Thực property value:

{
  "type": "string",
  "value": "test value"
}

Output

The output JSON contains a single field:

  • valid: A boolean indicating whether the provided validation data passed the validation check (true means valid).

If an error occurs during validation or other operations, the output will contain an error field with the error message.

No binary data is produced by this node.

Example output for successful validation:

{
  "valid": true
}

Example output for failure (if continue on fail is enabled):

{
  "error": "Validation failed due to invalid type."
}

Dependencies

  • Requires an API key credential for authenticating with the Sapo platform.
  • Depends on the internal SapoApiBase class to interact with the Sapo API metafields endpoints.
  • Needs proper configuration of the Sapo API credentials in n8n.

Troubleshooting

  • Common issues:

    • Invalid or missing resource ID may cause errors when identifying the target resource.
    • Incorrectly formatted validation data JSON can lead to validation failures.
    • Network or authentication errors if the API key is invalid or missing.
  • Error messages:

    • "Validation failed due to invalid type." — The value does not match the expected type.
    • "Resource not found." — The specified resource ID does not exist.
    • "Authentication failed." — API credentials are incorrect or expired.
  • Resolutions:

    • Ensure the resource ID corresponds to an existing resource in Sapo.
    • Verify the JSON structure and content of the validation data.
    • Confirm that the API key credential is correctly set up and has necessary permissions.

Links and References

Discussion