PocketBase icon

PocketBase

Perform CRUD and batch operations on PocketBase records using email/password authentication.

Actions6

Overview

This node enables interaction with PocketBase collections by performing CRUD (Create, Read, Update, Delete) and batch operations on records. It is useful for automating workflows that involve managing data stored in PocketBase databases, such as creating new entries, updating existing ones, retrieving records, or deleting them.

Practical examples include:

  • Automatically adding new user submissions to a PocketBase collection.
  • Updating inventory records based on external triggers.
  • Fetching filtered lists of records for reporting or further processing.
  • Performing multiple record operations in a single batch request to optimize API calls.

The "Create" operation specifically allows users to add a new record to a specified PocketBase collection by providing JSON data representing the record fields.

Properties

Name Meaning
Collection Name or ID The name or ID of the PocketBase collection where the new record will be created.
Data JSON object containing the fields and values for the new record to be created in the collection.

Output

The output is an array of items, each containing a json field with the response from PocketBase after creating the record. This typically includes the newly created record's data, such as its unique ID and any other fields returned by the PocketBase API.

Example output structure (simplified):

{
  "json": {
    "id": "record_id_generated_by_pocketbase",
    "field1": "value1",
    "field2": "value2",
    ...
  }
}

No binary data output is produced by this operation.

Dependencies

  • Requires an API key credential for authenticating requests to the PocketBase instance.
  • The node expects the base URL of the PocketBase server to be configured in the credentials.
  • Network access to the PocketBase API endpoint is necessary.

Troubleshooting

  • Common issues:

    • Invalid collection name or ID: Ensure the collection exists and the identifier is correct.
    • Malformed JSON in the "Data" property: Verify the JSON syntax and field names match the collection schema.
    • Authentication errors: Confirm the API key or authentication token is valid and has sufficient permissions.
    • Network connectivity problems: Check that the PocketBase server is reachable from n8n.
  • Error messages:

    • "Unknown operation \"create\"": Indicates the operation parameter was not recognized; ensure it is set correctly.
    • "Unknown resource \"record\"": Means the resource parameter is invalid; should be "record".
    • Errors including HTTP response details may indicate issues like permission denied, validation errors, or server errors. Review the error details for specifics.
  • To handle errors gracefully, enable the "Continue On Fail" option in the node settings to allow workflow execution to proceed despite individual item failures.

Links and References

Discussion