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

Blog → Tạo Mới

AI-generated

Overview

This node manages custom metafields on various resources within the Sapo platform, such as blogs, articles, products, and more. Specifically for the Blog resource with the Create operation, it allows users to add new custom fields (metafields) to a blog identified by its resource ID. This is useful for extending the metadata of blogs with additional structured information that is not part of the default schema.

Common scenarios include:

  • Adding custom tags or classifications to blogs.
  • Storing extra descriptive data like SEO keywords, author notes, or publication details.
  • Integrating with external systems that require specific metadata fields.

Example: Creating a metafield on a blog to store the warehouse location related to the blog content, e.g., namespace "inventory", key "warehouse_location", value "A-12".

Properties

Name Meaning
ID Tài Nguyên The numeric ID of the blog resource where the metafield will be created.
Dữ Liệu Trường Tùy Chỉnh JSON object defining the metafield data to create. It includes:
- namespace: grouping category for the metafield.
- key: identifier for the metafield.
- value: the actual value to store.
- value_type: type of the value (e.g., string).
- description: optional description of the metafield's purpose.

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 an array with one item containing a json field representing the response from the Sapo API after creating the metafield. This JSON typically contains the details of the newly created metafield, including its assigned ID and all submitted properties.

Example output structure:

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

No binary data 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 interact with the Sapo metafields endpoints.
  • Proper permissions on the Sapo account to create metafields on blog resources are necessary.

Troubleshooting

  • Error: Invalid resource ID or metafield data
    Ensure the ID Tài Nguyên corresponds to an existing blog and the JSON in Dữ Liệu Trường Tùy Chỉnh is correctly formatted and valid according to Sapo's API requirements.

  • API authentication errors
    Verify that the API key credential is correctly set up and has sufficient permissions.

  • Node fails without continuing on fail
    Enable "Continue On Fail" in the node settings to capture error messages in the output instead of stopping workflow execution.

  • Malformed JSON input
    The data property must be valid JSON. Use n8n's expression editor or JSON validator tools to ensure correctness.

Links and References

Discussion