Obsidian Vault REST API icon

Obsidian Vault REST API

Interact with Obsidian Vault via REST API

Overview

This node allows you to create files or directories within a file system or storage service accessible via an API. It is useful for automating the creation of new files or folders as part of workflows, such as generating reports, saving logs, or organizing data dynamically.

For example, you could use this node to:

  • Create a new text file with specific content in a project folder.
  • Create a directory structure before uploading multiple files into it.

Properties

Name Meaning
Path The full path where the file or directory will be created.
Type Specifies whether to create a "File" or a "Directory".
Content The textual content to write inside the file (only applicable if Type is "File").

Output

The node outputs JSON data representing the result of the create operation. This typically includes metadata about the newly created file or directory, such as its path and type. If the node supports binary data output, it would represent the created file's contents or reference, but based on the provided code and properties, the output focuses on JSON metadata.

Dependencies

  • Requires connection to a file system or storage service that supports REST API operations for creating files and directories.
  • Needs appropriate API credentials configured in n8n to authenticate requests.
  • The base URL and authentication details must be set up in the node’s credentials configuration.

Troubleshooting

  • Common issues:

    • Invalid or missing path: Ensure the "Path" property is correctly specified and the target location exists or can be created.
    • Insufficient permissions: Verify that the API credentials have rights to create files or directories at the specified path.
    • Incorrect content format: When creating a file, ensure the "Content" property contains valid string data.
  • Error messages:

    • Errors related to authorization usually indicate invalid or missing API credentials.
    • File system errors may indicate path conflicts or restrictions.
    • Validation errors occur if required properties like "Path" are empty.

Resolving these typically involves checking the input parameters, verifying API credentials, and ensuring the target environment supports the requested operations.

Links and References

Discussion