URL:
https://api.torn.com/v2/torn?selections=items&id=206
Issue:
on return, returns all information on all items not just the one in the id field.
Started by Strigwulf [2572775] on in Bugs & Issues.
Posts archived: 11 / 11 posts (100%) · the total is Torn's reply count + the opening post at the last fetch
Counted by TornLife from the archived posts.
URL:
https://api.torn.com/v2/torn?selections=items&id=206
Issue:
on return, returns all information on all items not just the one in the id field.
Workaround to pull back one item while waiting for fix:
https://api.torn.com/v2/torn/206%2C0/items?sort=ASC
It still gives the same bug if you only ask for one item
(hence adding the %2C0 for ",0" to make it parse the string and only return the info for the real item ID)
Example of the correct v2 query which exhibits the bug /torn/{ids}/items
https://api.torn.com/v2/torn/206/items?sort=ASC
Edit: I suspect this was caused by the v2 additions posted here:
https://www.torn.com/forums.php#/p=threads&f=63&t=16401584&b=0&a=0&start=280&to=25635968
Mentions: Upcoming API changes
I have instead, coded in a failsafe, to revert to API V1 instead of the workaround you have mentioned. once fixed shouldn't have to revise the code as the first call should correctly return the expected content.
Not sure if it will, as v2 "items" selection has been added, unless I misunderstand what that entry at the top of the swagger page meant.
I was just offering a working v2 query in case you were just using that, but yeah you can still use the v1 items selection to get the old behaviour :)
Torn V1 API endpoint is completely separate from V2.
V1:
https://api.torn.com/torn/206?selections=items&key=
works as expected
V2:
https://api.torn.com/v2/torn?selections=items&id=206
doesn't work as expected
So regardless of the amount of work arounds, the api endpoint mentioned at the start does not work as expected correct? So therefore bug, not feature.
The fact that the new v2 API doesn't work if you use the second /torn/{ids}/items if you only pass a single ID is a bug.
I don't know if the string you are sending is being passed to that selection and then falling foul of that bug, or if it is now being passed to the new v2 items selection which requires IDs instead of ID.
There is definitely a bug in the new selections, but I'm not sure if you sending the old v1 query string to the v2 endpoint (which they state will only work for as long as it isn't changed for v2) and no longer getting the v1 results is a bug in itself.
Hey - I fixed this issue. It should work from now on. By accident, this server was only processing multiple ids, but would ignore if there was only one.
So now this works:
https://api.torn.com/v2/torn?selections=items&id=206&key=
https://api.torn.com/v2/torn/206/items?key=
And this:
https://api.torn.com/v2/torn?selections=items&ids=206,207&key=
https://api.torn.com/v2/torn/206,207/items?key=
Thanks for the report!
Thanks splent, never used the v1 parameters at the v2 endpoint.
but thanks and Great job!