[Userscript] Query with level and vocabulary won't work

Any idea why this won’t work?

curl https://api.wanikani.com/v2/subjects?types=vocabulary&levels=7 -H “Authorization: Bearer bababa”

Using either of the filters works, yet the combination doesn’t.
Known bug?

Because it’s not a supported operation? It seems the only operations defined for subjects is to get them all of a type or with a specific ID.

API-Doc say it supports the ‘&’ parameter notation.

Collections have optional filters to help narrow the results returned. The filters are passed in as URL parameters, like ?parameter=value&other_parameter=value .

Oh okay I read it wrong then. Let me look. I’ll bust out postman.

Edit:

Works just fine for me in Postman. This is the GET URL that I used:

https://api.wanikani.com/v2/subjects?types=vocabulary&levels=1

Got back 40 results as expected. :man_shrugging:

Also just ran it via curl, and it worked just fine too. Just fed it this:

curl "https://api.wanikani.com/v2/subjects?types=vocabulary&levels=1" -H "Authorization: Bearer myAPIKey"

Got back the same 40 results as via Postman.

Edit:

Oh I see the problem. You didn’t put quotes around the URL. As soon as I do that I get an error. There’s a reason why the API doc has the quotes around the URL. It’s important to not remove that. :wink:

& require escaping in a URL unless you post the quotes around it.

Thank you very much. Solved the problem. :vulcan_salute:

1 Like