obsidian-api-request icon indicating copy to clipboard operation
obsidian-api-request copied to clipboard

Accessing multiple elements at the same time with & returns undefined

Open Lorite opened this issue 1 year ago • 1 comments

In the docs, it says that "To access multiple elements at the same time when using {..} use & to separate the keys and use . to access the values." I tried using the following block:

url: https://jsonplaceholder.typicode.com/todos
show: {..} -> userId & id
maketable: userId, id

and it returns a lot of undefined values.

Screenshots

Image

Desktop:

  • OS: Ubuntu

Thank you for the plugin in advance :D

Lorite avatar Feb 07 '25 15:02 Lorite

Hello @Lorite,

Right now, I’m working on a rebranding of this plugin. Some functionalities (those that interfere with core features) will be removed, while the rest will remain. Therefore, I don’t see it as feasible to fix this issue at the moment. However, I ran some tests and found a workaround (it’s a bit convoluted and impractical, so it’s up to you if you want to use it).

The idea is to make a request like the following (using the example you provided in the issue):

```req
url: https://jsonplaceholder.typicode.com/todos
show: {..} -> userId & id
req-id: 1
disabled
save-to: todos.json
```

This will make only one request and save the response in a file called todos.json. The disabled and req-id: 1 options will prevent the plugin from making more than one request. Then, using qjson, you can do something like this:

```qjson
#qj-id: 1
#qj-file: todos.json
#qj-hide-id
#qj-format: table[h:userId,:id]
```

And that would give you the output you were looking for. I know it’s not that straightforward, but at least there’s an option 😄.

Rooyca avatar Feb 10 '25 18:02 Rooyca