Skip to content
TORNLIFE More

User endpoint for multiple users

Started by Wizzeh [339207] on in API Development.

2 replies · 114 views · thread synced · 3 days ago · View on torn.com
About this thread

Posts archived: 3 / 3 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
3
Discussion span
→
People posting
3
Likes on archived posts
6
Authority score
50 / 100
Historical score
18 / 100
Story score
26 / 100
Engagement score
43 / 100
Wizzeh [339207]
I'd like to see an extension to the https://api.torn.com/user/ endpoint.

when you have to receive basic data for multiple users(either as comma separated values, or by params)
this would help to cut the amount of api calls needed

Proposed example:
https://api.torn.com/user/12345,67890,112234?selections=&key=KEY

this would make tracking users easier for chains / retaliation hits / ect
SVD_NL [2363978]
The API limit is in place for a reason. It's definitely technical (as we've seen the API buckle under increased server load), and likely to limit excessive data collection too.
In a database, your API call is going to be a query, it selects the fields you want by the index (torn or discord ID both are unique indexes here), and returns that data.
If you select multiple users, it's multiple queries on their end, so technically no difference.

This is a problem that can be worked around in most cases, especially in a faction context.
Want personal stats of members? Use the faction => contributions selection to get data from many personal stats in one call.
Use the faction => basic call to get the basic info of all members, including a quick way to get a member list.
Use the faction => attacks call to get data on attacks.
You can easily do a chain call to get the start and end dates, and use those to query the attacks that belong to the chain.
Furthermore you can also use that call to get a lot of data about the attacks, including if the attack was a retal or not.

So i doubt they'll implement this, because it defeats the purpose of having a call limit in the first place, it isn't how API's work in general, and there are ways to go around it.
I suggest you take a look at the API "documentation", do some test calls, and be creative with how you can approach the problem differently.
From my experience, i could either collect it real time using faction calls, or it's something i could easily do for every member individually on a set interval. Mind you, you've got 100 calls a minute, so you could iterate over an entire faction every minute.
Patient [2131539]
Just to expand on this.. not only is the API limited for the sake of performance, it's also limited to prevent giving people who use scripts too much of an advantage.

Allowing scripters to access detailed information on multiple people in a single call goes far beyond what a user is capable of without scripts.

In this example of looking at the faction call, a person without scripts could get all of the someone using the API does just by going to the faction's page. Granted, a scripter could get the information faster than someone who isn't using any, but the difference isn't as dramatic as if you could select multiple users in a single call, as the script would be able to get hundreds or thousands of user's details within the span of a minute, putting them above and beyond the mere convenience the API is meant to offer while still being balanced for people who don't use scripts.