BookStack icon

BookStack

Consume BookStack API

Overview

This node integrates with the BookStack API to manage various BookStack resources, specifically here focusing on the Attachment resource with the Get operation. It retrieves a single attachment by its ID from a BookStack instance.

Common scenarios where this node is beneficial include:

  • Fetching metadata or details about a specific file attachment stored in BookStack.
  • Automating workflows that require accessing attachments linked to pages, chapters, or books.
  • Integrating BookStack attachments into other systems or processes for further processing or display.

Practical example:

  • You have an automated process that needs to retrieve an attachment (e.g., an image or document) associated with a particular page in your BookStack documentation and then use it in another system like a CMS or email.

Properties

Name Meaning
Tool Description Choose how to determine the resource and operation:
- Set Automatically
- Set Manually
Request Description When "Set Automatically" is chosen, describe what you want to do (e.g., "Get attachment with ID 123"). The system uses this text to infer the resource and operation automatically.
ID The unique identifier of the attachment to retrieve. Required for the Get operation.

Output

The output contains a JSON object representing the retrieved attachment resource from BookStack. This typically includes all metadata fields provided by the BookStack API for an attachment, such as its ID, name, URL, size, and related resource references.

If the node supports binary data for attachments (e.g., the actual file content), it would be included in the binary output field; however, based on the static code, this node returns JSON metadata only.

Example output structure (simplified):

{
  "id": 123,
  "name": "example.pdf",
  "url": "https://bookstack.example.com/uploads/example.pdf",
  "size": 102400,
  "created_at": "2023-01-01T12:00:00Z",
  "updated_at": "2023-01-02T12:00:00Z",
  "related_resource_type": "page",
  "related_resource_id": 456
}

Dependencies

  • Requires connection to a BookStack instance via its API.
  • Needs an API token credential configured in n8n with:
    • Base URL of the BookStack API.
    • Authentication token and secret.
  • The node uses HTTP requests authenticated with these credentials to communicate with the BookStack API.

Troubleshooting

  • Missing or invalid ID: The "ID" property is required for the Get operation. If omitted or incorrect, the API will return an error indicating the resource was not found.
  • Authentication errors: Ensure the API token and base URL are correctly configured in the credentials. Common errors include unauthorized access or forbidden responses.
  • Resource not found: If the specified attachment ID does not exist, the API will return a 404 error.
  • Automatic detection issues: When using "Set Automatically," ambiguous or unclear request descriptions may lead to incorrect resource or operation detection. In such cases, switch to "Set Manually" and specify the resource and operation explicitly.
  • API endpoint errors: Network issues or incorrect base URLs can cause request failures. Verify connectivity and correct API endpoint configuration.

Links and References

Discussion