Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FR: Templates #20

Open
Rooyca opened this issue May 25, 2024 · 1 comment
Open

FR: Templates #20

Rooyca opened this issue May 25, 2024 · 1 comment
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@Rooyca
Copy link
Owner

Rooyca commented May 25, 2024

I think it would be a good idea to have a way to use APIR in templates. What is not clear to me is how to implement it. I have some ideas but I'm not sure which one would be the best:

  • Use a syntax like:
<@
id: 1
url: https://jsonplaceholder.typicode.com/todos/
method: POST
body: {}
header: {}
@>

This way the request would have the id 1 and we could use the responses in the whole document, right now I don't have a syntax for that, but it could be something like @=X=KEY.0.KEY (where X is the id number)

  • Maybe we could use a simpler syntax to make simple requests (GET only). Something like: <?url:URL.

P.S. I was also thinking about adding HTML parsing to extend even more the functionality of the templates. I don't know how viable this idea is, for the moment I'm going to focus on what I said above.


I'll love to hear your opinion and ideas.

  • Do you think the templates would be useful?
  • Would you use APIR templates in your workflow?
@Rooyca Rooyca added enhancement New feature or request help wanted Extra attention is needed labels May 25, 2024
@Rooyca Rooyca pinned this issue May 25, 2024
@djasonic
Copy link

Yes useful, mostly edge case perhaps but during templated note creation if filling out forms the ability to hydrate drop down selection lists with values dynamically pulled from an api or cached request would be pretty slick. I was about to implement requests within pure javascript before I found this plugin.

Recommend Templater User Scripts and implement APIR in those .js files, and not directly in the inline templater scripts themselves, in those just call out to the user script functions and pass in args.

For now I am going to try using APIR output in templater by loading the saved .json of a prior-run request to populate a list of Obsidian icons from Lucide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants