Payload CMS icon

Payload CMS

Consume the Payload CMS REST API

Actions5

Overview

This node integrates with the Payload CMS REST API to manage collection entries. It allows users to perform CRUD operations on collections configured in Payload CMS, such as creating new entries, retrieving single or multiple entries, updating existing entries, and deleting entries.

Common scenarios include:

  • Automating content creation by pushing new entries into a Payload CMS collection.
  • Fetching content dynamically for use in workflows or other systems.
  • Updating existing content based on external triggers.
  • Cleaning up or removing outdated content programmatically.

For example, you could use this node to create a new blog post entry in a "posts" collection by providing the collection slug and JSON data representing the post content.

Properties

Name Meaning
Collection Slug The unique identifier (slug) of the collection in Payload CMS where the entry resides.
JSON Data JSON-formatted data used to create or update a collection entry.

Output

The node outputs an array of JSON objects representing the collection entries returned from the API:

  • For create, get, update, and delete operations, the output contains the JSON representation of the affected entry.
  • For getAll, the output is an array of JSON objects, each corresponding to one entry in the collection.
  • The json field holds the raw data of the collection entries as returned by Payload CMS.

No binary data output is produced by this node.

Dependencies

  • Requires an active connection to Payload CMS via an API key credential.
  • The node depends on the Payload CMS REST API being accessible.
  • Requires configuration of the API authentication credentials within n8n.

Troubleshooting

  • Unknown operation error: If an unsupported operation is specified, the node throws an error indicating the operation is unknown. Ensure the operation is one of: create, get, update, delete, getAll.
  • Missing required parameters: Operations like create and update require valid JSON data; get, update, and delete require an entry ID. Missing these will cause errors.
  • API request failures: Network issues, invalid credentials, or incorrect collection slugs can cause API request failures. Verify credentials and collection slug correctness.
  • Empty results on getAll: If no entries are returned, check that the collection slug is correct and that entries exist in the collection.

Links and References

Discussion