coddingtonbear / obsidian-local-rest-api

Unlock your automation needs by interacting with your notes in Obsidian over a secure REST API.
MIT License
644 stars 59 forks source link

Cannot create folders #56

Closed juangamnik closed 1 year ago

juangamnik commented 1 year ago

I tried to create a new folder and cannot find a corresponding "command", and the "vault files" resource explicitly denies (with status code 405) to create a folder (e.g. via PUT). So how can I create a new folder in a vault with the REST API?

juangamnik commented 1 year ago

I looked through the open pull requests and saw #44, which is related to #43. The solution there is to auto create folders as a note is created in a folder that does not exist, yet. That would be a solution to my problem either since I try to create notes in a folder that das not exist in the vault, yet.

coddingtonbear commented 1 year ago

For sure -- this is a documented behavior, unfortunately; so this doesn't qualify as a bug. Maybe you can help @SettingDust work through #44, though, to solve your use case?

juangamnik commented 1 year ago

Why do you close this? It is a feature of obsidian not supported via the rest api…

juangamnik commented 1 year ago

So in essence: Why is creating a folder not part of the rest api

coddingtonbear commented 1 year ago

I'm closing this because this is not a bug, it's just not a feature even if you imagine it should be one. The mechanisms this plugin uses for interacting with your Obsidian vault do not interact with your vault as if it's a raw filesystem -- they instead interact with your vault via APIs Obsidian provides and that imposes certain quirks (see #21 for example).

If you'd like to shepherd through a solution on this, you are absolutely welcome to either contribute a solution to this via #44, invent and PR your own solution out of whole cloth, or are welcome to start a discussion to see if you can find somebody to write a solution for you (you can use the "Ideas" section for that sort of thing).

In any case: I'm afraid "Issues" on this project are for actual bugs or planned work, not feature requests.

juangamnik commented 1 year ago

@coddingtonbear: I am curious (I did not write any Plugins for Obsidian, yet) in the API Spec in line 3762ff there is a public class method (for class Vault) called createFolder(path: string): Promise<void>. Does it not work or why do you think it is documented behavior that folders cannot be created via the Obsidian API (not necessarily automatically but with a dedicated REST call)?

coddingtonbear commented 1 year ago

I think the answer to your question is on #44 -- have a look there and you'll see what the hang-up is. As I mentioned earlier, you can absolutely feel free to help work through the problems on that PR if you'd like to have this as a new feature of the REST API this plugin provides.

juangamnik commented 1 year ago

Sorry I read the comments on #44, but do not find any hint regarding a "hang-up". For me that PR is not necessarily the solution. For me it would be already helpful, if the Obsidian API function Vault.createFolder() would be exposed via the REST API. If I find some time I'll take a look at the implementation, but as I said I am not familiar with your Plugin or the Obsidian Plugin API.