PocketBase icon

PocketBase

Consume PocketBase API

Overview

This node integrates with the PocketBase API, allowing users to interact with PocketBase collections (referred to as Resources). It supports common CRUD operations such as listing/searching records, viewing a single record, creating new records, and updating existing ones.

Typical use cases include:

  • Retrieving paginated lists of records from a PocketBase collection with optional filtering, sorting, and expansion of related data.
  • Fetching detailed information about a specific record by its ID.
  • Creating new records in a collection by specifying field values.
  • Updating existing records by their ID with new field values.

For example, you could use this node to fetch a list of users with filters applied, view details of a particular user, or update user information programmatically within an n8n workflow.

Properties

Name Meaning
Parameters A collection of parameters to control list/search operations:
- Page The page number to retrieve (minimum 1).
- Elements per Page Number of elements to return per page (minimum 1).
- Filter A filter string to narrow down search results.
- Sort Sorting criteria for the results.
- Expand Related fields to expand in the response.

Note: Other properties exist but are not relevant for the "Default" Resource and Operation combination provided.

Output

The node outputs an array of JSON objects representing the data returned from PocketBase API calls:

  • For List/Search operation: Outputs an object containing paginated list data including items and metadata.
  • For View operation: Outputs a single record object.
  • For Create and Update operations: Outputs the created or updated record object.

No binary data output is produced by this node.

Dependencies

  • Requires a valid PocketBase API endpoint URL.
  • Requires authentication credentials: a username and password for PocketBase.
  • Uses the official PocketBase JavaScript client library.
  • Requires the "pocketBaseApi" credential configured in n8n with the necessary connection details.

Troubleshooting

  • Authentication failed!: This error occurs if the provided credentials are invalid or the authentication request fails. Verify the API URL, username, and password are correct.
  • Something went wrong: followed by a JSON error response indicates an issue with the API call, such as invalid parameters or resource not found. Check the parameters passed, especially element IDs and filters.
  • If the node is set to continue on fail, errors will be attached to the output item under an error property instead of stopping execution.
  • Ensure that the specified collection/resource exists in your PocketBase instance.
  • Pagination parameters must be positive integers; otherwise, the API may reject the request.

Links and References

Discussion