Sapo Trang icon

Sapo Trang

Quản lý trang CMS trên Sapo

Xóa

AI-generated

Overview

This node manages CMS pages on the Sapo platform, allowing users to create, retrieve, update, delete, count, and list pages. It is useful for automating content management workflows such as publishing new pages, updating existing page content, or cleaning up obsolete pages programmatically.

Practical examples include:

  • Automatically creating a new "About Us" page with specified content.
  • Fetching details of a specific page by its ID.
  • Deleting a page by its ID when it is no longer needed.
  • Listing multiple pages with filters like publication status or creation date.
  • Counting the total number of pages matching certain criteria.

Properties

Name Meaning
operation The action to perform on the CMS pages. Options: Count, Create New, Delete, Get Details, Get List, Update
pageId The unique numeric identifier of the page. Required for get, update, and delete operations.
returnAll Whether to return all results when listing pages (true) or limit the number of results (false). Only for "Get List".
limit Maximum number of pages to return when not returning all. Minimum value is 1. Only for "Get List".
additionalFields Additional optional filters for listing or counting pages, including:
- Published Status: All, Published, Unpublished
- Handle (URL slug) filter
- Created After/Before dates
- Updated After/Before dates
data JSON object containing page data fields such as title, body HTML, handle (slug), published status, template suffix, author. Required for create and update operations.

Output

The node outputs an array with one item containing a json field:

  • For create, get, update, and getMany operations, the json contains the page data returned from the API, which includes page properties like title, content, handle, publication status, etc.
  • For delete, the output JSON contains { success: true } indicating successful deletion.
  • For count, the output JSON contains { count: <number> } representing the total number of pages matching the criteria.
  • If an error occurs and "Continue On Fail" is enabled, the output JSON will contain an error field with the error message.

The node does not output binary data.

Dependencies

  • Requires an API key credential for authenticating with the Sapo platform's API.
  • Depends on the internal SapoApiBase class to interact with the Sapo API endpoints related to pages.
  • No additional external dependencies are required beyond the configured API authentication.

Troubleshooting

  • Common issues:

    • Providing an invalid or missing pageId for operations that require it (get, update, delete) will cause errors.
    • Incorrectly formatted JSON in the data property for create or update operations may result in API validation errors.
    • Network or authentication failures can prevent API calls from succeeding.
  • Error messages:

    • Errors from the API will be surfaced with their message and stack trace unless "Continue On Fail" is enabled, in which case the error message is returned in the output JSON.
    • To resolve errors, verify that the API credentials are correct, the pageId exists, and the input data conforms to expected formats.

Links and References

Discussion