Payload CMS icon

Payload CMS

Consume the Payload CMS REST API

Actions5

Overview

This node integrates with the Payload CMS REST API to perform operations on collections of documents. Specifically, for the "Collection" resource and the "Get" operation, it retrieves a single document entry from a specified collection by its unique ID.

Common scenarios where this node is useful include:

  • Fetching detailed information about a specific content item stored in Payload CMS.
  • Retrieving data for use in workflows that require up-to-date content from a CMS.
  • Integrating Payload CMS content into other systems or automations by pulling individual entries.

For example, you might use this node to get a blog post by its ID to display or process it further in your workflow.

Properties

Name Meaning
Collection Slug The slug identifier of the collection as configured in Payload CMS (e.g., "blogPosts").
Entry ID The unique ID of the document entry within the collection to retrieve.

Output

The output contains the JSON representation of the requested document entry from the collection. The structure matches the document's fields as stored in Payload CMS.

  • The json field holds the document data.
  • If the document includes any binary data (e.g., files or images), it would typically be represented separately, but this node focuses on JSON data retrieval.

Example output snippet:

{
  "json": {
    "id": "12345",
    "title": "Example Post",
    "content": "This is the content of the post.",
    ...
  }
}

Dependencies

  • Requires an active connection to Payload CMS via an API key credential configured in n8n.
  • The node uses the Payload CMS REST API endpoint corresponding to the collection slug and entry ID.
  • No additional external dependencies beyond the Payload CMS API and n8n environment are needed.

Troubleshooting

  • Missing or incorrect Collection Slug: Ensure the slug exactly matches the collection name configured in Payload CMS; otherwise, the API will return an error or no data.
  • Invalid Entry ID: Providing a non-existent or malformed entry ID will result in an error or empty response.
  • API Authentication Errors: Verify that the API key credential is correctly set up and has sufficient permissions to read collection entries.
  • Network Issues: Connectivity problems can cause request failures; check network access to the Payload CMS instance.
  • Error Messages: The node may throw errors indicating unknown operations if the operation parameter is misconfigured. For the "get" operation, ensure the correct parameters are provided.

Links and References

Discussion