Suggestion Type: New Feature Request
New api endpoints to return paginated list of all users and factions in the game.
Why do we need this?
The above post reminded me of this: there's no way to get a list all users or factions in the game from the api without performing what is essentially an enumeration attack on the game to iterate through all the possible ids.
What needs to be done?
Using v1 as an example, something like https://api.torn.com/torn/?selections=users&key={key}&page={number} which returns a response along the lines of:
{
"max_page": number,
"users": [
{
"id": number,
"name": string,
"signup": timestamp,
"level": number,
"faction_id": number|null,
"faction_name": string|null,
"last_action": {
"status": string,
"timestamp": number
},
"status": {
"description": string,
"details": string,
"state": string,
"until": number
}
},
// ... (100 or something results per page)
]
}
Similarly for factions https://api.torn.com/torn/?selections=factions&key={key}&page={number} and:
{
"max_page": number,
"factions": [
{
"id": number,
"name": string,
"tag": string,
"age": number,
"leader_id": number,
"leader_name": string,
"coleader_id": number|null,
"coleader_name": string|null,
"members": number,
"capacity": number,
"best_chain": best_chain,
"respect": number,
"rank": {
"level": number,
"name": string,
"division": number,
"position": number,
"wins": number
}
},
// ... (100 or something results per page)
]
}
Obviously the exact data returned probably needs a bit more thought put into it but this should be good enough for an example.
Drawbacks?
Shouldn't be anything major with the minimal concept. It's something which is already possible, just in a rather ugly manner. If there were more complex filtering options, especially for users, that might present an advantage to scripters depending on what those filtering options were (e.g. for finding chain targets).