Rooyca / obsidian-api-request

Obsidian plugin that allows you to make requests to API's and receive responses in codeblocks or store them in localStorage.
https://rooyca.github.io/obsidian-api-request/
MIT License
78 stars 4 forks source link

Multiple show variables and output in format #6

Closed nickian closed 2 months ago

nickian commented 3 months ago

Thanks for the great plugin. I'm not sure if this is currently possible, couldn't find a way, but we could specify multiple variables in one request?

For instance, something like this:

url: https://someurl.com/api
show: nested -> varaible1, nested -> variable2
format: Show the output for 1 here {} and for two here {}.

Or even more simple, to be able to do this:

url: https://someurl.com/api
format: Show the output for 1 here {nested->variable1} and for two here {nested->variable1}.
Rooyca commented 2 months ago

Hey! I'm glad you like it. That's a great idea, I'll try to work on it this weekend.

tlwt commented 2 months ago

Adding to this request. It would also be great one could loop thru the results. E.g. I use paperless-ngx for my document management. A query can contain an array of documents related to some project/contact etc.

url: https://paperless-ngx.com/api
show: results -> added, results -> title
format: <table><th><td>added</td><td>title</td></th>{loop}<tr><td>{}</td><td>{}</td></tr>{/loop}</table>
Rooyca commented 2 months ago

@tlwt

url: https://paperless-ngx.com/api
show: results -> added, results -> title
format: <table><th><td>added</td><td>title</td></th>{loop}<tr><td>{}</td><td>{}</td></tr>{/loop}</table>

At the moment I'm not quite sure how to do this. I was thinking of adding a new property (loop) with which you specify if you want to iterate over the outputs.

I don't know, I'll keep thinking about some way to achieve it.

Rooyca commented 2 months ago

Hey @nickian! I would love to hear your feedback on the feature.

PS: Sorry for taking so long to solve this issue :smiley:

nickian commented 2 months ago

That's great, thanks! Works as expected and just what I was thinking.