Can't get [[body]] to work with obsidian Obsidian Advanced URI..need advice

Hi all

so I have this action im trying to use with obsidian Obsidian Advanced URI with no success and getting a error:Invalid URL:

this is the url I have in place

obsidian://advanced-uri?vault=PKM&filepath=300-399%20Work/312%20research%20ideas/Journal%20modeling.md&data=[[body]]&mode=append

and this is the error I get in the log

Invalid URL: obsidian://advanced-uri?vault=PKM&filepath=300-399%20Work/312%20research%20ideas/Journal%20modeling.md&data=&mode=append

if I replace [[body]] with just XX and run the url it works perfectly

obsidian://advanced-uri?vault=PKM&filepath=300-399%20Work/312%20research%20ideas/Journal%20modeling.md&data=XXXX&mode=append

what a I missing here?

PS the reason I went URL instead of save to file is that my obsidian vault is on iCloud and couldn’t get the bookmark thing to work as it kept asking for permissions…

best

Z

Try {{[[body]]}} to URL encode the draft body content.

See this special markup section in the docs:

  1. Bookmarks should prompt for folder selection/permissions once per device you use a named Bookmark. Is that not what you are seeing? If so, I’d love a bug report with details. There are things that could require the permissions to reset (folder being moved, etc.), but it should not be regularly re-authing.

  2. Not sure how you are constructing and using this URL. If in an Open URL action step, just turn on the “Encode tags” option in the step and it will URL encode the results of your template tags for you. Or, if you doing this in script, wrapping a {{ }} (as @sylumer notes) is template markup for
    “URL encode this text”.

  3. If you are constructing URLs for the “Open URL” step, it’s sometimes handy to use “Define Template Tag” steps to create tags for the different parameter values, and let the “Encode Tags” option on the URL step do the encoding. Makes it easier to define parameters, like the filepath in your example. Example of use in this Bear action.

Thank you both @sylumer and @agiletortoise

@sylumer I did try with {{[[body]]}} yet that gave me the same error

interestingly with the native obsidian URI (which just added append very recently I found out) it does seem to work fine, ie

obsidian://new?vault=PKM&file=300-399%20Work/312%20research%20ideas/Journal%20modeling.md&content=%0A%0A[[content]]&append

oh well I can just used the native methods :slight_smile:

@agiletortoise , this is the error I get when adding a bookmark:

image

do I need to manually use the CLI to change permissions on the folder? in any case happy to send a bug report if needed (where do I file the bug report to?)

thx a lot!

Z

You should get that dialog, and you do need to select the folder in the prompt that follows. Are you saying it does not remember that permission in subsequent uses of the Bookmark on that device? It should. If it doesn’t, do you have some other process that manipulates that folder, possibly resetting permissions or similar?

Hi again

yes it keeps asking for permissions

not aware of any process running on the folder

happy to help debug if needed (though I went the URI route)

best

Z

I set up the same file and directory structure in my demo vault (obsidian_demo), the same URL (with a revised vault name) you used worked fine for me. Each time it appended the body of the draft (content without the title), to the vault.

obsidian://advanced-uri?vault=obsidian_demo&filepath=300-399%20Work/312%20research%20ideas/Journal%20modeling.md&data=[[body]]&mode=append

2022-03-30-18.08.36

Regarding your permissions issue, when did you last reboot the device you are testing on, and what happens if you choose a different folder path as a test?

mm just yesterday. other folders even outside iCloud I see give the same error

thx!

Z

I am using pmbauer “Move to Obsidian” action but cannot make the APPEND action to work. I want new drafts to append to an existing Obsidian note (always the same note). Is not working. I get a new, separate, Obsidian note created each time I run the action.

pmbauer callback URL back is:
obsidian://new?append=yes&name=[[name]]&content=[[content]]

Anyone can pls help?

Thanks Manuel

I would normally expect a Boolean parameter to conventionally use true rather than yes. Try amending that for the append parameter and see if that changes the behaviour.