BookStack icon

BookStack

Consume BookStack API

Overview

This node integrates with the BookStack API to manage various BookStack resources such as books, pages, chapters, shelves, users, roles, attachments, and tags. Specifically for the Chapter resource with the Copy operation, it allows duplicating an existing chapter within BookStack.

The node supports two modes of operation:

  • Automatic mode: You provide a natural language description of your request (e.g., "Copy the chapter 'Introduction'"), and the node attempts to parse and determine the appropriate resource and operation automatically.
  • Manual mode: You explicitly select the resource ("Chapter") and operation ("Copy") and provide required parameters like the chapter ID.

Typical use cases include:

  • Duplicating a chapter to reuse its content in another book or section.
  • Automating content management workflows by programmatically copying chapters.
  • Integrating BookStack content duplication into larger automation pipelines.

Example: Copying a chapter with ID 123 to a target book or shelf by specifying the target location.

Properties

Name Meaning
Tool Description Choose how to determine the resource and operation:
- Set Automatically
- Set Manually
Request Description (Shown only if "Set Automatically" is selected) A natural language description of what you want to do, e.g., "Copy the chapter 'Introduction'"
Resource (Shown only if "Set Manually" is selected) The type of resource to operate on. For this case: "Chapter"
Operation (Shown only if "Set Manually" is selected) The action to perform on the resource. For this case: "Copy"
ID The ID of the chapter to copy (required for copy operation)

Note: The bundled code shows additional properties for other operations and resources, but for the Chapter-Copy operation, the key input is the chapter ID and optionally target location parameters handled internally.

Output

The node outputs JSON data representing the response from the BookStack API after performing the copy operation. This typically includes details of the newly created copied chapter, such as its ID, name, and metadata.

The output structure is:

{
  "json": {
    // Response object from BookStack API for the copied chapter
  },
  "pairedItem": {
    "item": <index_of_input_item>
  }
}

No binary data output is involved in this operation.

Dependencies

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

Troubleshooting

  • Common issues:

    • Invalid or missing chapter ID will cause the API call to fail.
    • Incorrect or expired API tokens will result in authentication errors.
    • Target shelf or book IDs for copy destination may need to be set correctly; otherwise, the copy might not behave as expected.
    • Automatic mode parsing may fail if the natural language description is ambiguous or does not match expected patterns.
  • Error messages:

    • Authentication errors: Check API token validity and permissions.
    • 404 Not Found: Verify the chapter ID exists.
    • 400 Bad Request: Ensure all required parameters are provided and valid.
  • Resolution tips:

    • Use manual mode to explicitly specify resource, operation, and IDs if automatic detection fails.
    • Confirm API credentials and base URL are correct.
    • Review the request description for clarity when using automatic mode.

Links and References

Discussion