Q about including user life in faction member data | API Devel…

Q about including user life in faction member data

    • CurlyBracket [2766476]
    • Role: Civilian
    • Level: 82
    • Posts: 879
    • Karma: 876
    • Last Action: 25 minutes
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Thread created on 14:57:40 - 18/09/24 (2 months ago)
    |
    Last replied 14:29:53 - 19/09/24 (2 months ago)

    Currently, the faction lookup response includes a members array with info about each member that includes last_action and status.  It does not include their life (i.e. max, current, etc.) so that requires N more calls for individual user responses to gather that info. I would assume this has been asked about in the past, but can't find anything in the forum.  Is this on purpose out of principle?  Or could we get the faction response extended to include the life section for each member as well?

    • Omanpx [1906686]
    • Role: Civilian
    • Level: 100
    • Posts: 2,455
    • Karma: 15,757
    • Last Action: 4 hours
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 15:20:43 - 18/09/24 (2 months ago)
    Post link copied to clipboard Copy post link

    While there might be some niche use cases, this would open a horrible can of worms. Why not include their basicicons as well? That would potentially be way more useful. What about donator status to estimate energy related metrics? Heck, let's add the entire output of user/profile to save making extra calls.

     

    Do you see how this could get out of hand? Could you provide a reasonable, commonly used case for when you need the user's exact life at least?

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

    Guidebook - a collection of guides i made for Torn.

    • miku [3165390]
    • Role: Civilian
    • Level: 39
    • Posts: 58
    • Karma: 23
    • Last Action: 24 days
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 17:00:09 - 18/09/24 (2 months ago)
    Post link copied to clipboard Copy post link

    That would just increase response times and server strain for the majority of times when you don't need all that extra data.

    https://editor.torn.com/4f542e43-8f6d-46e6-925d-f2a2dc69e8df-2112670.gif

    • CurlyBracket [2766476]
    • Role: Civilian
    • Level: 82
    • Posts: 879
    • Karma: 876
    • Last Action: 25 minutes
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 17:01:13 - 18/09/24 (2 months ago)
    Post link copied to clipboard Copy post link

    Omanpx [1906686]

    While there might be some niche use cases, this would open a horrible can of worms. Why not include their basicicons as well? That would potentially be way more useful. What about donator status to estimate energy related metrics? Heck, let's add the entire output of user/profile to save making extra calls.

     

    Do you see how this could get out of hand? Could you provide a reasonable, commonly used case for when you need the user's exact life at least?

    The case I'm imagining is when you're warring and want to see opponents life when you're selecting targets.  Most of the other stuff in the user response doesn't change very often, so occasional user requests will pull those values.  It's life, last_action and status that change more frequently that would trigger more pulls.

    Last edited by CurlyBracket on 17:03:39 - 18/09/24 (2 months ago)
    • CurlyBracket [2766476]
    • Role: Civilian
    • Level: 82
    • Posts: 879
    • Karma: 876
    • Last Action: 25 minutes
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 17:10:21 - 18/09/24 (2 months ago)
    Post link copied to clipboard Copy post link

    miku [3165390]

    That would just increase response times and server strain for the majority of times when you don't need all that extra data.

    For all I know, the api controller already has the data from the DB when looking up the other bits (E.g. last_action and status), and so including it may not materially increase the server load, other than by an extra few bytes in the response.  And there's all sorts of info in each response that may not be used in the majority of cases (e.g. what % of API users actually care about married status, or friend/enemy/karma counts?  If you're going to take that approach, you might as well include request flags for what response components you want and which you don't.  But that would unnecessarily complicate the code for not much of a win.  I'm curious how many API consumers end up polling the user API more frequently than they would in order to get that info...it might actually reduce some some server strain by eliminating a bunch of unnecessary user queries.

    • miku [3165390]
    • Role: Civilian
    • Level: 39
    • Posts: 58
    • Karma: 23
    • Last Action: 24 days
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 17:27:42 - 18/09/24 (2 months ago)
    Post link copied to clipboard Copy post link

    CurlyBracket [2766476]

    For all I know, the api controller already has the data from the DB when looking up the other bits (E.g. last_action and status), and so including it may not materially increase the server load, other than by an extra few bytes in the response.  And there's all sorts of info in each response that may not be used in the majority of cases (e.g. what % of API users actually care about married status, or friend/enemy/karma counts?  If you're going to take that approach, you might as well include request flags for what response components you want and which you don't.  But that would unnecessarily complicate the code for not much of a win.  I'm curious how many API consumers end up polling the user API more frequently than they would in order to get that info...it might actually reduce some some server strain by eliminating a bunch of unnecessary user queries.

    It makes reasonable sense for friend/enemy/karma counts to be accessed with a user API call since that information is on the profile page. However, you can't see life on the faction page which is probably why you can't get it directly with a faction API call. Also I don't know your exact use case but I'd imagine you could probably filter out members by last_action or status and then get the life of those players afterwards. 

    https://editor.torn.com/4f542e43-8f6d-46e6-925d-f2a2dc69e8df-2112670.gif

    • CurlyBracket [2766476]
    • Role: Civilian
    • Level: 82
    • Posts: 879
    • Karma: 876
    • Last Action: 25 minutes
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 14:29:53 - 19/09/24 (2 months ago)
    Post link copied to clipboard Copy post link

    Ah - it turns out that it has already been implemented in the v2 API.  So problem solved!

     

    https://www.torn.com/forums.php#/p=threads&f=63&t=16402659&b=0&a=0&start=60&to=25160782

     

Reply
Thread Title: