Sapo Trang icon

Sapo Trang

Quản lý trang CMS trên Sapo

Lấy Chi Tiết

AI-generated

Overview

This node manages CMS pages on the Sapo platform, allowing users to perform various operations such as creating new pages, retrieving details of a specific page, updating existing pages, deleting pages, counting pages, and listing multiple pages. It is useful for automating content management workflows in e-commerce or website projects that use Sapo as their CMS backend.

Practical examples include:

  • Automatically creating a new CMS page when a marketing campaign launches.
  • Fetching detailed information about a specific page to display or process elsewhere.
  • Updating page content programmatically based on external data sources.
  • Deleting outdated pages as part of cleanup automation.
  • Counting pages to generate reports or monitor content volume.
  • Listing pages with filters like publication status or creation date for batch processing.

Properties

Name Meaning
operation The action to perform on the CMS pages. Options: "count", "create", "delete", "get", "getMany", "update".
pageId The unique numeric ID of the page. Required for "get", "update", and "delete" operations.
returnAll (For "getMany") Whether to return all pages or limit the number of results.
limit (For "getMany" when returnAll is false) Maximum number of pages to return. Minimum 1.
additionalFields (For "getMany" and "count") Optional filters such as published status ("any", "published", "unpublished"), handle (URL slug), created/updated date ranges.
data (For "create" and "update") JSON object containing page data fields like title, body_html, handle, published status, template suffix, author, etc.

Output

The node outputs an array with one item containing a json field. The structure of this JSON depends on the operation:

  • For "get" and "getMany": JSON contains page details or a list of pages matching the criteria.
  • For "create" and "update": JSON contains the newly created or updated page data.
  • For "delete": JSON contains { success: true } if deletion was successful.
  • For "count": JSON contains { count: <number> } representing the total number of pages matching filters.

No binary data output is produced by this node.

Dependencies

  • Requires an API key credential for authenticating with the Sapo platform's API.
  • Depends on the internal Sapo API base class to perform HTTP requests to Sapo endpoints.
  • No additional environment variables are explicitly required beyond the API authentication setup.

Troubleshooting

  • Common issues:

    • Invalid or missing page ID for operations requiring it ("get", "update", "delete") will cause errors.
    • Providing malformed JSON in the data property for create/update can lead to request failures.
    • Using filters in additionalFields incorrectly may result in empty responses or errors.
    • Network or authentication failures with the Sapo API will throw errors.
  • Error messages:

    • Errors from the Sapo API are caught and either thrown or returned as error objects depending on the node’s "Continue On Fail" setting.
    • Typical error messages include invalid credentials, resource not found (invalid page ID), or validation errors on input data.
  • Resolutions:

    • Ensure the API key credential is correctly configured and has necessary permissions.
    • Validate that pageId is provided and is a valid number for applicable operations.
    • Check JSON syntax and required fields in the data property.
    • Use correct filter values in additionalFields.

Links and References

Discussion