Skip to content
TORNLIFE More

API Caching Bug

Started by Zurich [2163658] on in Bugs & Issues.

5 replies · 53 views · thread synced · 3 days ago · View on torn.com
About this thread

Posts archived: 6 / 6 posts (100%) · the total is Torn's reply count + the opening post at the last fetch

Counted by TornLife from the archived posts.

Archived posts
6
Discussion span
→
People posting
3
Likes on archived posts
2
Authority score
48 / 100
Historical score
17 / 100
Story score
35 / 100
Engagement score
43 / 100
Zurich [2163658]
It seems that there is some sort of cached response with certain API url formats. Below is the format in question.

https://api.torn.com/user/0?selections=basic&key=


Given a key, this call will return info for the owner of the key. However, if the call is made shortly after with a different key, the incorrect user is returned.

Having 0 as the ID for this type of call is obviously not best practice. but it's clearly valid as it will return the correct data the first time. Removing the user ID allows this API call to return the correct data every time. However, inconsistent behavior in the API definitely seems quite buggy.

Reproduction steps:
Call the URl above with two different API keys in short succession. The data will likely be identical.
After, remove the 0 from the URL. Following the same tests, you no longer get duplicated data.
Zurich [2163658]
That doesn't seem to be the issue. If you remove the ID, you can rapidly make calls with different API keys without receiving duplicate data. The behavior is inconsistent. Try it for yourself with the reproduction steps
.
Stewie [1494547]
If you remove the ID, you can rapidly make calls with different API keys without receiving duplicate data.
I will pass to Joe to see if it is intentional.

I am not sure on the use of '0' as the ID parameter, however. If you want the owner's own data, you'd just do it with no ID I'm sure.
Zurich [2163658]
I agree that it is not the correct usage of that sort of call, but it is still a call that can be made without an error returned. Therefore I believe the behavior should be made consistent and accurate.