PocketBase icon

PocketBase

Consume PocketBase API

Overview

This node integrates with the PocketBase API to perform CRUD operations on PocketBase collections (referred to as Resources). Specifically, for the Update operation on the Default resource, it updates an existing element in a specified collection by its Element ID. Users provide the ID of the element they want to update and specify the fields and their new values.

Common scenarios where this node is useful include:

  • Modifying records in a PocketBase database when data changes.
  • Automating updates to user profiles, inventory items, or any other collection entries.
  • Integrating PocketBase with other systems to keep data synchronized.

Example: Updating a user's email address or status in a "users" collection by specifying the element's ID and the new field values.

Properties

Name Meaning
Element ID The unique identifier of the element in the collection to update. Required for update and view operations.
Parameters Optional query parameters such as Page, Elements per Page, Filter, Sort, and Expand (not used in update).
Body Parameters A collection of key-value pairs representing the fields to update and their new values. Multiple fields can be updated at once.

Details on Body Parameters:

  • Name: The field name or ID in the PocketBase collection to update.
  • Value: The new value to assign to that field.

Output

The node outputs a JSON array where each item corresponds to the result of updating one element. Each output item contains the full updated record as returned by the PocketBase API after the update operation.

If multiple input items are processed, the output will be an array of updated elements in the same order.

No binary data output is produced by this node.

Dependencies

  • Requires a valid PocketBase API endpoint URL.
  • Requires credentials including:
    • API URL
    • Username and password for authentication against PocketBase.
  • Uses the official PocketBase JavaScript client library.
  • Requires n8n credential configuration to securely store and access the PocketBase API credentials.

Troubleshooting

  • Authentication failed!
    This error occurs if the provided username/password or API URL is incorrect or the PocketBase server is unreachable.
    Resolution: Verify credentials and network connectivity.

  • Element ID missing or invalid
    If the Element ID parameter is empty or does not correspond to an existing record, the update will fail.
    Resolution: Ensure the Element ID is correct and exists in the target collection.

  • Invalid field names or values in Body Parameters
    If the field names do not match the collection schema or values are of incorrect types, the update may fail.
    Resolution: Confirm field names and data types match those defined in the PocketBase collection.

  • API errors during update
    Errors from the PocketBase API (e.g., validation errors) will be thrown.
    Resolution: Review the error message details and adjust input accordingly.

  • When continueOnFail is enabled, the node will continue processing subsequent items even if some updates fail, attaching error information to the output.

Links and References

Discussion