Sapo Trang icon

Sapo Trang

Quản lý trang CMS trên Sapo

Lấy Danh Sách

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 single page, listing multiple pages with filtering options, updating existing pages, deleting pages, and counting pages based on criteria. It is useful for automating content management workflows in e-commerce or website projects that use Sapo as their CMS backend.

Common scenarios include:

  • Automatically syncing CMS pages from Sapo into another system.
  • Bulk fetching pages with filters like publication status or creation date.
  • Creating or updating pages programmatically based on external data.
  • Deleting obsolete pages as part of cleanup automation.
  • Counting pages matching certain conditions for reporting or monitoring.

Example: Fetching all published pages created after a specific date to generate a report or migrate content.

Properties

Name Meaning
Thao Tác (operation) The action to perform: Count pages, Create new page, Delete page, Get page details, List pages, Update page.
ID Trang (pageId) The unique identifier of the page; required for get, update, and delete operations.
Trả Về Tất Cả (returnAll) Whether to return all results when listing pages or limit the number of results returned.
Giới Hạn (limit) Maximum number of pages to return when not returning all (only applies if returnAll is false).
Thông Tin Bổ Sung (additionalFields) Additional filters for listing or counting pages:
- Trạng Thái Xuất Bản (published_status): any, published, unpublished
- Handle: filter by page URL slug
- Tạo Sau (created_at_min): filter pages created after this date/time
- Tạo Trước (created_at_max): filter pages created before this date/time
- Cập Nhật Sau (updated_at_min): filter pages updated after this date/time
- Cập Nhật Trước (updated_at_max): filter pages updated before this date/time
Dữ Liệu Trang (data) JSON object representing page data used for create and update operations. Example fields:
title, body_html, handle, published, template_suffix, author

Output

The node outputs an array with one item containing a json field holding the result of the operation:

  • For get, create, update: The JSON object represents the page details returned by the API.
  • For getMany (list): The JSON contains an array of pages matching the filters and limits.
  • For delete: Returns { success: true } upon successful deletion.
  • For count: Returns an object with a count property indicating the number of pages matching the filters.
  • On error (if continueOnFail is enabled), returns { error: "error message" }.

No binary data output is produced by this node.

Dependencies

  • Requires an API key credential for authenticating with the Sapo API.
  • Uses the internal Sapo API base class to interact with the Sapo CMS endpoints.
  • No additional environment variables are explicitly required beyond the API credential.

Troubleshooting

  • Common issues:

    • Invalid or missing API credentials will cause authentication failures.
    • Providing an invalid page ID for get, update, or delete operations will result in errors.
    • Using filters with incorrect formats (e.g., invalid dates) may cause API request failures.
    • Exceeding rate limits imposed by the Sapo API could lead to temporary blocking.
  • Error messages:

    • Errors from the API are caught and either thrown or returned as error objects depending on the node's continueOnFail setting.
    • Typical error messages include authentication errors, resource not found, validation errors on input data, or server errors.
  • Resolution tips:

    • Verify API credentials and permissions.
    • Double-check page IDs and filter values.
    • Use the "returnAll" option carefully to avoid large data loads.
    • Enable continueOnFail during testing to capture error details without stopping workflows.

Links and References

Discussion