API Suggestions & Improvements | API Development | TORN

API Suggestions & Improvements

    • splent [2088243]
    • Role: Admin
    • Level: 95
    • Posts: 709
    • Karma: 1,978
    • Last Action: 1 hour
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Thread created on 13:47:22 - 03/06/24 (5 months ago)
    |
    Last replied 15:04:13 - 27/11/24 (5 days ago)

    Hello everyone, 

    I would like to have a dedicated thread for API suggestions & improvements.

    It's not certain that all of the suggestions will be accepted & implemented, but if I'm not even aware of them, it won't be possible to even add them in the first place!

    In order to make everything easier to discuss & potentially plan and implement, if you have a suggestion, follow the following format:

    Suggestion type:
    (Concisely categorize your suggestion/request)
     - New feature request
     - Minor improvement
     - General improvement (accross multiple endpoints)
     - Optimization/Performance improvement
     - Something else

    What needs to be done:
    (Shortly describe what needs to be done)
     - (e.g. for the new feature request) - add API to get forum threads & posts data
     - (e.g. for the minor improvement) - restructure user>personalstats section to have statistics categories
     - (e.g. for the general improvement) - change all 1 & 0 to true & false

    Why do you need this:
    (Back up your suggestion or request with some information on why do you need this change)
     - (e.g. for the new feature request above) - What @Omanpx wrote in another thread: It would create more opportunities for community-run events, such as this one.
     - (e.g. for the minor improvement above) - it would make much more sense if personal stats had sections like we currently have on statistics page - attacks, finishing hits, drugs, travel, etc...Maybe even rename fields so they're not called "cantaken" but instead "cannabis", etc.
     - (e.g. for the general improvement above) - it would be easier for my app to handle booleans than manually converting all zeroes and ones to boolean values.

    Consider any drawbacks of your suggestion:

    ! Remember that API should not provide unfair advantage over players that are unable or don't know how to use the API. The primary goal of the API is to enhance gameplay and not to provide advantage.
     - (e.g. for the new feature request above) - This could be very heavy on the BE as there is lots of information on forums. It could be hard to properly implement this feature because results from private forums should be excluded/included depending on the user.
     - (e.g. for the minor improvement above) - No concerns for this improvement.
     - (e.g. for the general improvement above) - Requires thorough testing to make sure this change is applied to all endpoints.

    Example:
    (Finally, provide an example of the API change) 

    {
        "posts": [

        {
            "thread_id": string,
            "post_id": string,
            "player_name": string,
            "player_id": number,
            "created_dt": string,
            "modified_dt": string,
            "content": string,
            "likes": number,
            "dislikes": number,

        },

        ...

        ]
    }


    ---

    Few things to note:
    - In general api v2 will have all "ID" fields renamed. E.g. "ammoID" becomes "ammo_id", and all requests will follow the same naming convetion.
    - Some other fields will also be renamed. E.g. "attacker_faction" becomes "attacker_faction_id" and "attacker_factionname" becomes "attacker_faction_name", etc.
    - There will be some reconstructuring done overall. E.g. "personalstats" will really have fields renamed (like in the example above) and grouped into categories (drugs, attacks, finishing hits, travel, etc.)
    - I'm looking to remove all key->value arrays, so the key will be a part of an object instead. E.g. [ "1": { ... }, "2": { ... } ] becomes [ { id: 1, ... }, { id: 2, ... } ]
    - Please continue posting any relavant bugs to the Bugs & Issues forum.

    Thank you,

    Mauro

    Last edited by splent on 21:57:13 - 21/08/24 (3 months ago)
  • Pinned Response
    • splent [2088243]
    • Role: Admin
    • Level: 95
    • Posts: 709
    • Karma: 1,978
    • Last Action: 1 hour
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 08:22:58 - 16/09/24 (2 months ago)
    Post link copied to clipboard Copy post link

    splent [2088243]

    Hello everyone, 

    I would like to have a dedicated thread for API suggestions & improvements.

    It's not certain that all of the suggestions will be accepted & implemented, but if I'm not even aware of them, it won't be possible to even add them in the first place!

    In order to make everything easier to discuss & potentially plan and implement, if you have a suggestion, follow the following format:

    Suggestion type:
    (Concisely categorize your suggestion/request)
     - New feature request
     - Minor improvement
     - General improvement (accross multiple endpoints)
     - Optimization/Performance improvement
     - Something else

    What needs to be done:
    (Shortly describe what needs to be done)
     - (e.g. for the new feature request) - add API to get forum threads & posts data
     - (e.g. for the minor improvement) - restructure user>personalstats section to have statistics categories
     - (e.g. for the general improvement) - change all 1 & 0 to true & false

    Why do you need this:
    (Back up your suggestion or request with some information on why do you need this change)
     - (e.g. for the new feature request above) - What @Omanpx wrote in another thread: It would create more opportunities for community-run events, such as this one.
     - (e.g. for the minor improvement above) - it would make much more sense if personal stats had sections like we currently have on statistics page - attacks, finishing hits, drugs, travel, etc...Maybe even rename fields so they're not called "cantaken" but instead "cannabis", etc.
     - (e.g. for the general improvement above) - it would be easier for my app to handle booleans than manually converting all zeroes and ones to boolean values.

    Consider any drawbacks of your suggestion:

    ! Remember that API should not provide unfair advantage over players that are unable or don't know how to use the API. The primary goal of the API is to enhance gameplay and not to provide advantage.
     - (e.g. for the new feature request above) - This could be very heavy on the BE as there is lots of information on forums. It could be hard to properly implement this feature because results from private forums should be excluded/included depending on the user.
     - (e.g. for the minor improvement above) - No concerns for this improvement.
     - (e.g. for the general improvement above) - Requires thorough testing to make sure this change is applied to all endpoints.

    Example:
    (Finally, provide an example of the API change) 

    {
        "posts": [

        {
            "thread_id": string,
            "post_id": string,
            "player_name": string,
            "player_id": number,
            "created_dt": string,
            "modified_dt": string,
            "content": string,
            "likes": number,
            "dislikes": number,

        },

        ...

        ]
    }


    ---

    Few things to note:
    - In general api v2 will have all "ID" fields renamed. E.g. "ammoID" becomes "ammo_id", and all requests will follow the same naming convetion.
    - Some other fields will also be renamed. E.g. "attacker_faction" becomes "attacker_faction_id" and "attacker_factionname" becomes "attacker_faction_name", etc.
    - There will be some reconstructuring done overall. E.g. "personalstats" will really have fields renamed (like in the example above) and grouped into categories (drugs, attacks, finishing hits, travel, etc.)
    - I'm looking to remove all key->value arrays, so the key will be a part of an object instead. E.g. [ "1": { ... }, "2": { ... } ] becomes [ { id: 1, ... }, { id: 2, ... } ]
    - Please continue posting any relavant bugs to the Bugs & Issues forum.

    Thank you,

    Mauro

    DieselBlade [1701621]

    What is the current lead time for these suggestions?

     

    Will all of these suggestions make it into the API? If not, which ones?

     

    It would be great if you could communicate somewhere what suggestions you like and what ones you're going to implement. Perhaps a list on the first post?

     

    Otherwise, we're making suggestions to make our own scripts and bots more functional but we don't know if they will ever be implemented. 

    Hey, that's a great point. Most of the suggestions will get implemented as they're very reasonable requests.

     

    There are a few that could not really be easily implemented and are on hold for now. 

    Here's the current status of suggestions:

    Already done:

    • ✅ Player revivable status
    • ✅ Crimes data
    • ✅ Calendar
    • ✅ Racing data
    • ✅ Forum data
    • ✅ Hall of Fame
    • ✅ Log type IDs within each log category ID
    • ✅ Bounties
    • ✅ Player rank in city jobs 

    Will be added (soon™) or already work in progress:

    • Choose between non-html & html for various selections (WIP)
    • Item UID’s added across faction endpoints
    • Inventory
    • Change 'signup' in 'user > profile' to timestamp
    • Reverse name searches 
    • Company employee value (with secretary)
    • Historical API key usage
    • Remaining API calls 
    • Current bank investment info
    • Attacklog endpoint to the API
    • Auction house 
    • Faction enlistment status 
    • Completed trades

     

    And those that are currently on hold because they're either not easily implementable (would require substantial work) or some concerns exist: 

    • Item UID’s addded to market>bazaar and market>itemmarket (concern: could be very easy to track RW sales and owners -> mugging bots?)
    • Add 'rankedwarassists' to public stats (comment: unsure if this one is necessary?)
    • Support for IPv6 access to the Torn API (comment: out of my current scope)
    • Change 'User' -> 'Bazaar' to require limited access API (unlikely: there's already a global 30s delay unless requesting information for other bazaars)
    • Paginated list of all users and factions (unlikely, although not set in stone on this one yet)
    • Daily active users tarball (concern: company/faction recruiters would use it to spam people to oblivion)
    • OAUTH2 (gladly, but requires a lot of work. Maybe once everything else is done in v2)
    • Bookie bets (concern: some players might become mugging targets. Maybe with a full-access key, but not a priority)w
    • Add 'faction' -> 'armorynewsfull' (unfortunately, I can't provide the data in the desired format. The 'armorynews' selection is just a API copy of Armory News on the faction page, so I would need to parse the logs to provide the data in that format)

     

    Last edited by splent on 11:33:27 - 30/09/24 (2 months ago)
    • Wootty2000 [2344687]
    • Role: Civilian
    • Level: 100
    • Posts: 113
    • Karma: 152
    • Last Action: 3 hours
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 15:49:23 - 03/06/24 (5 months ago)
    Post link copied to clipboard Copy post link

    Minor improvement - Player revivable status

    Current - When an API call is made to check if a player can be revived (even if they are not in hospital) currently the output is 1 or 0, based on the target's setting of Nobody / Everyone / Friends & Faction, with Friends & Family being in the target has the API key owner as a friend, or if they are from the same faction

    Improvement - return either an integer value, 0 (Nobody), 1 (Friend & Faction), 2 (Everyone) or return the strings. Return the highest value. If I check with my key and a faction member has the value set to Everyone, I should be returned 2 or Everyone

    Reasons - When in ranked wars, factions regularly check their own faction to see if their members have left revives enabled.
    With the current system, you either use your own API keys (from within the faction) and get false positives or you use someone else's key (still with some false positives as they might be friends with the target) to check either the complete faction's member list or you use a hybrid of both, using your own key to get an initial list and then cross reference with someone else's key (reducing load on other person's key but increasing the total numer of API calls)


    • Hemicopter [2780600]
    • Role: Civilian
    • Level: 74
    • Posts: 1,482
    • Karma: 3,562
    • Last Action: 2 hours
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 16:51:58 - 04/06/24 (5 months ago)
    Post link copied to clipboard Copy post link

    New feature request - Add User-related crime data in v2

     

    Currently, there exist different endpoints for "global crime state", namely torn>searchforcash and torn>shoplifting.

    This is good for knowing which uniques could be gotten, but that's about it.

     

    I would like an endpoint like user>crimes, so that user-specific state can be evaluated.

     

    Why do I need it?

    There is a lot of, let's call it data analysis, you can do with real-time-ish data.

    For example, YATA could give you an estimate when you can claim your "250 details in 1 card skimmer" honor based on the state of your card skimmers.

    Another use case can be some sort of notification system for when a card skimmer gets found.

    It could also make a shopping list for your current forgery projects, and once inventory api is back, check if you need to buy some items.

     

    The list is practically endless, and with 19 more crimes coming, will be even longer. The spreadsheet people can have a field day :D

     

    This data is also already available, but for automated means inaccessible due to the scripting rules. The so called "crimesHubApi" returns user and global state of the crimes system. I would argue that most work was already done, it "just" needs to follow new v2 naming standards. The crimesHubApi is the base for showing the icons on the crime hub. 

     

    What could be drawbacks?

    - Until all crimes are released, there will have to be (ir)regular changes applied to this endpoint. 

    - As I said, the current implementation does not follow v2 naming standards.

    - The data would be available in the crimeHubApi (which does not fall under the API ratelimits) and the normal api (with its ratelimits), so there might be double the maintenance work associated with that.

    - IIRC, Ched said something about crimes not being a real time system, and things being generated "once you looked". I'm not sure how true this statement still is (and if the crimesHubApi is the thing that triggers it), but this might lead to only stale data being able to be read.

    - The data is highly irregular from crime to crime.

     

    Example:

    I'll point to the existing URL, but because I don't want to post my CF api key, you can find your personal links by being at loader.php?sid=crimes and looking in the dev tools. The URL looks like this:

    https://www.torn.com/crimesHubApi.php?userID=2780600&apiKey=XXX&rfcv=YYY

    (the crimeHubApi uses the typeID parameter to only load one crime at the time, but this is optional. Check it out without a typeID, ty!)

    • Lazerpent [2112641]
    • Role: Civilian
    • Level: 100
    • Posts: 828
    • Karma: 3,513
    • Last Action: 24 minutes
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 16:52:25 - 04/06/24 (5 months ago)
    Post link copied to clipboard Copy post link

    New Feature request - OAUTH2

     

    Now it's worth noting this might be outside the current purview of API v2, but I want to get a bit of publicity on this so (potentially) at some point something could be done.

     

    I would like some form of OAUTH2 support for the API to enable "Login with Torn".

     

    The bearer/access token would be used in API calls (like a normal API key) and the refresh token would be used to obtain a new access token when it expires (as normal OAUTH2 works).

    It would be great if (similar to API permissions) custom permissions could be requested when setting up the app (so on prompt it would say "Do you want to login to MyService as ?" "This will give MyService access to the following data: ..."

     

     

    Why do we (the developer community) need this?

    One major "lacking" point when creating apps is the inherent insecurity of "verifying" someone is who they say they are.

     

    Take the (fairly standard) login with API (for example what torn.report, tornexchange, and yata use). When a user logs in, there is no way to "know" for sure they are actually the user they say they are. I could share my API with a 3rd party service, then my key could be used to login as me (with or without my permission, there's no way to know).

     

    "Login with key" also is just confusing for users who don't know much about the API. I have had many cases where I have had to explain to someone what the API is, what data the particular key gives access to, if its secure, etc.

     

    Another example of login is "Login with Discord" which allows for (better) verification of identity (except not really due to a bug that was published about a month ago about how this is not actually true) but the downside is you still need to ask for an API token.

     

    A third way to do it is having a standard login (username/password) then tie an API key to the account. This has no real benefits other than needing more secure credentials to login.

     

    How would this benefit the community?

    This would drastically cut down on any "confusion" as well as make login more secure. Login would be streamlined (don't need to redirect to API page, tell the user to copy the key, come back and paste), and by standardizing around one method (that checks all the boxes), it cuts down on the need for many different methods of authentication.

     

    This also has a bonus of standardizing around "the standard". OAUTH2 is the industry standard protocol for authentication. And by adding this, it would allow 3rd party tools better integration, presenting a better user experience.

     

    What are drawbacks?

    The primary drawback is time. While there are standardized libraries for OAUTH2, there would need to be a new UI component (to show current connections), some "portal" where developers could manage their app_id/name (this could be as simple as a API endpoint with no UI, or a subpage in the OAUTH2 settings page).

     

    That having been said, while there is definitely overhead in creating this, the pros would drastically improve the way users interact with 3rd party apps.

     

     

    Last edited by Lazerpent on 17:08:24 - 04/06/24 (5 months ago)

    • Lazerpent [2112641]
    • Role: Civilian
    • Level: 100
    • Posts: 828
    • Karma: 3,513
    • Last Action: 24 minutes
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 17:14:22 - 04/06/24 (5 months ago)
    Post link copied to clipboard Copy post link

    Wootty2000 [2344687]

    Minor improvement - Player revivable status

    Current - When an API call is made to check if a player can be revived (even if they are not in hospital) currently the output is 1 or 0, based on the target's setting of Nobody / Everyone / Friends & Faction, with Friends & Family being in the target has the API key owner as a friend, or if they are from the same faction

    Improvement - return either an integer value, 0 (Nobody), 1 (Friend & Faction), 2 (Everyone) or return the strings. Return the highest value. If I check with my key and a faction member has the value set to Everyone, I should be returned 2 or Everyone

    Reasons - When in ranked wars, factions regularly check their own faction to see if their members have left revives enabled.
    With the current system, you either use your own API keys (from within the faction) and get false positives or you use someone else's key (still with some false positives as they might be friends with the target) to check either the complete faction's member list or you use a hybrid of both, using your own key to get an initial list and then cross reference with someone else's key (reducing load on other person's key but increasing the total numer of API calls)


    I actually strongly disagree with this as written. The data your talking about is private to the user, and is not "knowable" by a 3rd party user (someone in your opponents faction for example).

     

    That having been said, your 100% right that having this data would be extremely useful for faction leaders. I would like to suggest a minor improvement to create a new faction->reviveStatus endpoint (only available to those with faction API access) to get the current revive status of each faction member all at once.

     

    This has a few benefits:
    Allows for quick checking of revive status for your whole faction

    Maintains privacy for users, meaning that no new data is exposed to 3rd parties.

     

     

    Now there is an argument to be made that it does not matter if a 3rd party could "know" this, since its not really useful information on its own. But its worth maintaining that the API does not give any "new" information that is not available through the site

    Last edited by Lazerpent on 17:15:32 - 04/06/24 (5 months ago)

    • Skeletron [318855]
    • Role: Civilian
    • Level: 100
    • Posts: 685
    • Karma: 1,961
    • Last Action: 39 minutes
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 19:51:12 - 04/06/24 (5 months ago)
    Post link copied to clipboard Copy post link
    Suggestion type:
    New feature request
     
    What needs to be done:
    Add an API endpoint to retrieve all log type IDs within each log category ID. This would need to update as new logs are added (for example, when new crime logs are added to the Nerve and Crimes categories).
     
    Why is this needed:
    This feature will allow users to look up which log type IDs to load for any given category instead of loading entries by log category ID.
    By loading log types individually, users can get entries from before a log type was added to the category. For instance, Hunting logs within the Energy category don't go all the way back, but loading the log individually goes all the way back to when logs were introduced.
     
    Additionally, it will help avoid loading overlapping logs, such as the Rehab logs found in both Travel and Drugs categories.
     
    Drawbacks:
    None that I can think of at the moment.
     
    Example:
    {
        "log_categories": {
          "87": [
            4201,
            6000,
            6001,
            ...
          ],
          ...
        }
    }
    • Stig [2648238]
    • Role: Reporter
    • Level: 100
    • Posts: 1,029
    • Karma: 2,436
    • Last Action: 1 hour
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 20:58:43 - 04/06/24 (5 months ago)
    Post link copied to clipboard Copy post link

    Suggestion type:

     - General improvement (accross multiple endpoints)

     

    What needs to be done:

    - Armourynews, attacknews, and various other ‘news’ endpoints be rebuilt entirely to provide non-html data.
    - Have weapon / item UID’s added to various locations, such as armorynews and armory endpoints

     

    Why do you need this:

    - It can be inconsistent to parse on our side, and requires us to know all types of the log to be able to parse it correctly in some cases.

     

    Consider any drawbacks of your suggestion:

    - None that I can think of

     

    Examples:

     

    [Armorynews]

    {
    "armorynews": {
    "ml4H2HEDR4XSC1op5SlI": {"news": "Stig [2648238] deposited a Gold Plated AK-47.",
    "uid": 123,
    "timestamp": 1708597707
    }
    }
    }

     

    This could be made more indepth by including ‘player’ or something and ‘target’ and more data about the item used etc.

     

    [Armory]

    {
    "weapons": [
    {
    "ID": 108,
    "name": "9mm Uzi",
    "type": "Primary",
    "quantity": 3,
    "available": 3,
    "loaned": 0,
    "loaned_to": null
    "uids": [1, 2, 3]
    },
    ]
    }

     

    Im not sure how we would signify which weapons have been loaned etc. Perhaps having each weapon in a list, instead of them being grouped is more appropriate. 

    Last edited by Stig on 21:00:18 - 04/06/24 (5 months ago)
    • splent [2088243]
    • Role: Admin
    • Level: 95
    • Posts: 709
    • Karma: 1,978
    • Last Action: 1 hour
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 18:10:51 - 05/06/24 (5 months ago)
    Post link copied to clipboard Copy post link

    Wootty2000 [2344687]

    Minor improvement - Player revivable status

    Current - When an API call is made to check if a player can be revived (even if they are not in hospital) currently the output is 1 or 0, based on the target's setting of Nobody / Everyone / Friends & Faction, with Friends & Family being in the target has the API key owner as a friend, or if they are from the same faction

    Improvement - return either an integer value, 0 (Nobody), 1 (Friend & Faction), 2 (Everyone) or return the strings. Return the highest value. If I check with my key and a faction member has the value set to Everyone, I should be returned 2 or Everyone

    Reasons - When in ranked wars, factions regularly check their own faction to see if their members have left revives enabled.
    With the current system, you either use your own API keys (from within the faction) and get false positives or you use someone else's key (still with some false positives as they might be friends with the target) to check either the complete faction's member list or you use a hybrid of both, using your own key to get an initial list and then cross reference with someone else's key (reducing load on other person's key but increasing the total numer of API calls)


    Lazerpent [2112641]

    I actually strongly disagree with this as written. The data your talking about is private to the user, and is not "knowable" by a 3rd party user (someone in your opponents faction for example).

     

    That having been said, your 100% right that having this data would be extremely useful for faction leaders. I would like to suggest a minor improvement to create a new faction->reviveStatus endpoint (only available to those with faction API access) to get the current revive status of each faction member all at once.

     

    This has a few benefits:
    Allows for quick checking of revive status for your whole faction

    Maintains privacy for users, meaning that no new data is exposed to 3rd parties.

     

     

    Now there is an argument to be made that it does not matter if a 3rd party could "know" this, since its not really useful information on its own. But its worth maintaining that the API does not give any "new" information that is not available through the site

    I wanted to say the same - I don't think this should be public information, but I do think this could be added to the faction API (I don't think adding to "users" section would be beneficial in any way though). 
    But again, because currently, this is player personal information, maybe it will be necessary to first add an additional setting like:

    b750112e-839b-4304-a0ac-6a0aee9305f8-2088243.png

    Otherwise that sounds like a good idea to me (also because basically only player's factions would benefit from this, and I would argue that if you're in a faction in the first place you're there to "serve" (while getting something in return ofc)).

    @Wootty2000 I'll keep you (and everyone else) updated on what's decided on this one. 

    Last edited by splent on 18:19:41 - 05/06/24 (5 months ago)
    • splent [2088243]
    • Role: Admin
    • Level: 95
    • Posts: 709
    • Karma: 1,978
    • Last Action: 1 hour
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 18:58:56 - 05/06/24 (5 months ago)
    Post link copied to clipboard Copy post link

    Hemicopter [2780600]

    New feature request - Add User-related crime data in v2

     

    Currently, there exist different endpoints for "global crime state", namely torn>searchforcash and torn>shoplifting.

    This is good for knowing which uniques could be gotten, but that's about it.

     

    I would like an endpoint like user>crimes, so that user-specific state can be evaluated.

     

    Why do I need it?

    There is a lot of, let's call it data analysis, you can do with real-time-ish data.

    For example, YATA could give you an estimate when you can claim your "250 details in 1 card skimmer" honor based on the state of your card skimmers.

    Another use case can be some sort of notification system for when a card skimmer gets found.

    It could also make a shopping list for your current forgery projects, and once inventory api is back, check if you need to buy some items.

     

    The list is practically endless, and with 19 more crimes coming, will be even longer. The spreadsheet people can have a field day :D

     

    This data is also already available, but for automated means inaccessible due to the scripting rules. The so called "crimesHubApi" returns user and global state of the crimes system. I would argue that most work was already done, it "just" needs to follow new v2 naming standards. The crimesHubApi is the base for showing the icons on the crime hub. 

     

    What could be drawbacks?

    - Until all crimes are released, there will have to be (ir)regular changes applied to this endpoint. 

    - As I said, the current implementation does not follow v2 naming standards.

    - The data would be available in the crimeHubApi (which does not fall under the API ratelimits) and the normal api (with its ratelimits), so there might be double the maintenance work associated with that.

    - IIRC, Ched said something about crimes not being a real time system, and things being generated "once you looked". I'm not sure how true this statement still is (and if the crimesHubApi is the thing that triggers it), but this might lead to only stale data being able to be read.

    - The data is highly irregular from crime to crime.

     

    Example:

    I'll point to the existing URL, but because I don't want to post my CF api key, you can find your personal links by being at loader.php?sid=crimes and looking in the dev tools. The URL looks like this:

    https://www.torn.com/crimesHubApi.php?userID=2780600&apiKey=XXX&rfcv=YYY

    (the crimeHubApi uses the typeID parameter to only load one crime at the time, but this is optional. Check it out without a typeID, ty!)

    - IIRC, Ched said something about crimes not being a real time system, and things being generated "once you looked". I'm not sure how true this statement still is (and if the crimesHubApi is the thing that triggers it), but this might lead to only stale data being able to be read.


    I won't neither confirm nor deny, because I didn't work with that or looked at that code, but that makes sense to me. 
    To me, it wouldn't make sense to generate crimes for someone who didn't log in on the day and store all of that information into db (e.g. new cracking targets or pickpocketing targets, etc). 

    I think crime specific statistics (statistics you can see for each crime) would be more realistic to get API for, but I don't know if you would make any use of that? 

    • Hemicopter [2780600]
    • Role: Civilian
    • Level: 74
    • Posts: 1,482
    • Karma: 3,562
    • Last Action: 2 hours
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 19:23:46 - 05/06/24 (5 months ago)
    Post link copied to clipboard Copy post link

    Hemicopter [2780600]

    New feature request - Add User-related crime data in v2

     

    Currently, there exist different endpoints for "global crime state", namely torn>searchforcash and torn>shoplifting.

    This is good for knowing which uniques could be gotten, but that's about it.

     

    I would like an endpoint like user>crimes, so that user-specific state can be evaluated.

     

    Why do I need it?

    There is a lot of, let's call it data analysis, you can do with real-time-ish data.

    For example, YATA could give you an estimate when you can claim your "250 details in 1 card skimmer" honor based on the state of your card skimmers.

    Another use case can be some sort of notification system for when a card skimmer gets found.

    It could also make a shopping list for your current forgery projects, and once inventory api is back, check if you need to buy some items.

     

    The list is practically endless, and with 19 more crimes coming, will be even longer. The spreadsheet people can have a field day :D

     

    This data is also already available, but for automated means inaccessible due to the scripting rules. The so called "crimesHubApi" returns user and global state of the crimes system. I would argue that most work was already done, it "just" needs to follow new v2 naming standards. The crimesHubApi is the base for showing the icons on the crime hub. 

     

    What could be drawbacks?

    - Until all crimes are released, there will have to be (ir)regular changes applied to this endpoint. 

    - As I said, the current implementation does not follow v2 naming standards.

    - The data would be available in the crimeHubApi (which does not fall under the API ratelimits) and the normal api (with its ratelimits), so there might be double the maintenance work associated with that.

    - IIRC, Ched said something about crimes not being a real time system, and things being generated "once you looked". I'm not sure how true this statement still is (and if the crimesHubApi is the thing that triggers it), but this might lead to only stale data being able to be read.

    - The data is highly irregular from crime to crime.

     

    Example:

    I'll point to the existing URL, but because I don't want to post my CF api key, you can find your personal links by being at loader.php?sid=crimes and looking in the dev tools. The URL looks like this:

    https://www.torn.com/crimesHubApi.php?userID=2780600&apiKey=XXX&rfcv=YYY

    (the crimeHubApi uses the typeID parameter to only load one crime at the time, but this is optional. Check it out without a typeID, ty!)

    splent [2088243]

    - IIRC, Ched said something about crimes not being a real time system, and things being generated "once you looked". I'm not sure how true this statement still is (and if the crimesHubApi is the thing that triggers it), but this might lead to only stale data being able to be read.


    I won't neither confirm nor deny, because I didn't work with that or looked at that code, but that makes sense to me. 
    To me, it wouldn't make sense to generate crimes for someone who didn't log in on the day and store all of that information into db (e.g. new cracking targets or pickpocketing targets, etc). 

    I think crime specific statistics (statistics you can see for each crime) would be more realistic to get API for, but I don't know if you would make any use of that? 

    Oh, certainly you could use that!

    The only API-way of getting (most of) this data currently is by parsing all logs since migration. Obviously you can use fewer calls then :D

     

    This would also allow for a more robust unique tracking, as long as the "considered unique" and "seen" outcome IDs are tracked. (because some unique outcomes have been changed over time, and this has made the tracking more challenging) (Edit: there was a dude that got a unique during a period where no logs were saved, so this is also a thing that would fix this)

    The torn.report item view would also be just 1 / "# of crimes" calls after that, because it is visible in those statistics.

    This would still be tied to a lot of changes, every time some change is made. For example a new forgery option.

     

    Obviously, I would like both of those, the statistics and the real time data. :p

     

    I personally wouldn't have an issue if self-regenerating targets like pickpocketing, cracking, disposal, etc. would only be reflected once a user triggered a calculation, but having more basic data of forgery cooldown timestamps, burglary target timestamps, hustling game skills, etc. should still be feasible...   

    Last edited by Hemicopter on 18:14:10 - 12/06/24 (5 months ago)
    • zachwozn [2301700]
    • Role: Civilian
    • Level: 69
    • Posts: 201
    • Karma: 104
    • Last Action: 1 hour
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 23:51:10 - 06/06/24 (5 months ago)
    Post link copied to clipboard Copy post link

    New Feature Request Events

    Torns Calendar is a static list of events every year.
    Having an endpoint would make it a little easier to automatically implement events via tools instead of manually grabbing each event at the start of each year. Consider a new endpoint torn -> events

    Looking something like this
    events: [
    {
    "event_name": [

    {
    "start_time": 1714316465,
    "end_time": 1715316465,
    "event_details": "Details of event",
    "user_start_times": True/False
    }

    ]
    }

    ]

    XBGglsZ.pngLVI

     

    • GreenNipple [2563870]
    • Role: Civilian
    • Level: 100
    • Posts: 226
    • Karma: 54
    • Last Action: 3 hours
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 10:29:12 - 07/06/24 (5 months ago)
    Post link copied to clipboard Copy post link

    Suggestion type:
     - New feature request

    What needs to be done:
     - add API to get racing data
     - this could potentially go under https://api.torn.com/torn/?selections=races and take the race ID(s) as parameter(s), or under User section       and have all your races 



    Why do you need this:
    For custom racing series and results it would be a lot easier and quicker to get race results. There are many big racing series (URT, TRL, etc) and many faction races that would benefit from this


    Consider any drawbacks of your suggestion: 
     - This might have to change as other developers might want other info available as well


    Example:


    {
        "races": [

        {
            "race_id": number,
            "track_id": number,
            "race_name": string,
            "timestamp": number,
            "results": [
            {   
               "pos": number,
               "player_id": number,
               "racing_skill": number,
               "total_time": time/string,
               "best_lap_time": time/string,
               "car_id": number,
            },
            ...

        },

        ...

        ]
    }

    Someone else will probably expand on this idea and add to the example 

    • MCSH [2855875]
    • Role: Civilian
    • Level: 81
    • Posts: 298
    • Karma: 807
    • Last Action: 2 months
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 22:31:07 - 07/06/24 (5 months ago)
    Post link copied to clipboard Copy post link

    Suggestion type:

     - New feature request?

     

    What needs to be done:

    Bring back the inventory API

     

    Why do you need this:

    Various reasons. I would personally use it to remind myself of items I'm missing (temps / drugs / boosters / etc) or choose travel destination. Though I know a lot of other users have other uses in mind.

     

    Consider any drawbacks of your suggestion: 

     

    Aside from the server usage I'm not sure what drawbacks could be there. This was part of the API until very recently.

     

    Example:

    Could look exactly like the previous inventory API. Additionally it could accept filter of item id types or category ids.

    • DeKleineKobini [2114440]
    • Role: Committee
    • Level: 100
    • Posts: 3,784
    • Karma: 5,405
    • Last Action: 3 hours
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 10:09:46 - 09/06/24 (5 months ago)
    Post link copied to clipboard Copy post link

    Suggestion type:
     - Minor improvement

    What needs to be done:

    Currently 'signup' within the 'user > profile' endpoint is a string formatted as "yyyy-MM-dd HH:mm:ss". Doing this as epoch timestamp would be more uniform and easier to work with.

    Why do you need this:

    Exposing dates as epoch timestamp makes much more sense than a (formatted) string.


    Consider any drawbacks of your suggestion:

    No concerns for this improvement.

    • Lazerpent [2112641]
    • Role: Civilian
    • Level: 100
    • Posts: 828
    • Karma: 3,513
    • Last Action: 24 minutes
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 14:31:55 - 09/06/24 (5 months ago)
    Post link copied to clipboard Copy post link

    Suggestion Type: New Feature Request

    I would love to see reverse name searches in the API

     

    Why do we need this?

    As the API stands, there is really no way to take a name (of a user, of a faction, etc), and get the associated ID. We (developers) can maintain lookup tables of names to IDs, but its quite challenging to keep up to date, since names can change at any time, and (excluding filters of active users) there are a TON of users to keep track of.

     

    What needs to be done?

    It would be great to have a new endpoint specifically for reverse name lookups. I.E. names->(player, faction, company) which would accept a name as the ID. For example, https://api.torn.com/name/lazerpent?selections=player&key= would return my ID and name (name so that capitalization can be captured).

     

    It would also be great to be able to do partial matches (as search at the top of the page does, typing lazer shows 10 people whos name starts with lazer).

     

    Drawbacks?

    There are no drawbacks I can see. This functionality already exists exactly as written (in the search, which allows for all 3 types).

    • Entropi [2486892]
    • Role: Civilian
    • Level: 100
    • Posts: 467
    • Karma: 112
    • Last Action: 3 minutes
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 06:27:05 - 10/06/24 (5 months ago)
    Post link copied to clipboard Copy post link

    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).

    • Omanpx [1906686]
    • Role: Civilian
    • Level: 100
    • Posts: 2,358
    • Karma: 15,285
    • Last Action: 3 hours
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 06:48:18 - 10/06/24 (5 months ago)
    Post link copied to clipboard Copy post link

    Entropi [2486892]

    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).

    That's a tough one. Something like 90% of all users and factions are basically inactive, so just returning a list would not be very useful. On the other hand, if it returned too much info about a player, it would be abused like hell. For example, if it gave last online status and company employment info, it would be abused like crazy by recruiters. Same goes for factions. This would even further remove player involvement imo. 

    If you need a full list of factions (which you can use to filter out most active players anyway), you can use the one i have on chedslist About page.

    Toolbox - a collection of my tools and spreadsheets made for Torn.

    Guidebook - a collection of guides i made for Torn.

    • Entropi [2486892]
    • Role: Civilian
    • Level: 100
    • Posts: 467
    • Karma: 112
    • Last Action: 3 minutes
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 11:17:08 - 10/06/24 (5 months ago)
    Post link copied to clipboard Copy post link

    That's a tough one. Something like 90% of all users and factions are basically inactive, so just returning a list would not be very useful.

     

    The main intended use I was envisioning for it is for populating new users and factions, plus making it easier for people to do already existing ones, without needing to resort to incrementing the ids.

     

    On the other hand, if it returned too much info about a player, it would be abused like hell. For example, if it gave last online status and company employment info, it would be abused like crazy by recruiters. Same goes for factions. This would even further remove player involvement imo. 

     

    Yeah, in the example I went for the same information from the currently existing method of mass fetching users via their faction. The proposed addition definitely shouldn't have so much information that everybody just uses it instead of looking up user details. It would even work decently if just the id, name, and maybe last activity (for considering whether to pull further data on the person) were in the results.

     

    Recruitment wise, there are already bots notifying when somebody leaves a faction. Likewise people already can request all the newly created accounts individually each day if they want to recruit. Could also do something like only show accounts newer than a day or few days to make it harder for people to use it to recruit new players quickly - though this can be done already with the existing api functionality. So, while it might make some forms of recruitment if the faction was included a little easier, it's not necessarily introducing something which isn't already possible in some form. At 100 per page, it's also unlikely to replace the faction departures recruitment bots since 33k requests versus a few hundred to check most factions.

     

    If you need a full list of factions (which you can use to filter out most active players anyway), you can use the one i have on chedslist About page.

     

    I pulled them some time ago. This is more just meant to make it easier for others to be able to do the same and to make it simpler to continue adding new factions.

    Last edited by Entropi on 11:17:35 - 10/06/24 (5 months ago)
    • JKyte [2417425]
    • Role: Civilian
    • Level: 100
    • Posts: 756
    • Karma: 996
    • Last Action: 12 minutes
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 09:23:31 - 11/06/24 (5 months ago)
    Post link copied to clipboard Copy post link

    Entropi [2486892]

    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).

    An endpoint to get just the ids of active players would be great. R+

    • tiksan [2383326]
    • Role: Civilian
    • Level: 100
    • Posts: 944
    • Karma: 1,248
    • Last Action: 58 minutes
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 13:56:25 - 11/06/24 (5 months ago)
    Post link copied to clipboard Copy post link

    Entropi [2486892]

    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).

    JKyte [2417425]

    An endpoint to get just the ids of active players would be great. R+

    Or a tarball that’s updated daily with the data of all users would be even better.

    LnNwLrL.gif

Reply
Thread Title: