Upcoming API changes - Page 13 | API Development | TORN

Upcoming API changes

    • PhantomReaper [2291318]
    • Role: Civilian
    • Level: 28
    • Posts: 84
    • Karma: 45
    • Last Action: 3 hours
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 21:17:05 - 04/11/24 (1 month ago)
    Post link copied to clipboard Copy post link

    splent [2088243]

    Hey everyone, several fixes and smaller improvements today: 

    • Added 'rarity' field ("yellow", "orange", "red" or null) to 'user' -> 'itemmarket' and 'market' -> 'itemmarket' selections
    • The "item" field should now always be populated in "market' -> 'itemmarket' even if there are no listings
    • Added a few more bonus filters: "Any", "Double", "Yellow", "Orange" & "Red"
    • The 'torn' -> 'itemstats' will now return "0" for "owner_id" if the item is being sold anonymously on market OR if it was never used
    • Fixed 'user' -> 'hof' selection from returning incorrect values for some players
    • Weapon bonuses in Swagger are now sorted alphabetically (lol i know it was important to some)

     

    As always, Swagger schema is updated to reflect these changes.


    Important note!

    We'll be closing 'market' -> 'bazaar' selection in two weeks, as it doesn't serve much purpose currently.

    I know instead many would rather if we added global cache and bazaar owner information to this selection, but unfortunately, because this information is no longer visible anywhere else in Torn it needs to be removed.
    However, as soon as, or, if bazaars appear somewhere else in Torn, I'll be more than happy to prioritize that and create a relatable selection ASAP.

    Thanks!


    Nooooooooooo

    • PhantomReaper [2291318]
    • Role: Civilian
    • Level: 28
    • Posts: 84
    • Karma: 45
    • Last Action: 3 hours
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 21:19:09 - 04/11/24 (1 month ago)
    Post link copied to clipboard Copy post link

    Oh wait I don't use market > bazaar lol I use user > bazaar lol it's ok :P

    • Beerstein [1322136]
    • Role: Civilian
    • Level: 17
    • Posts: 21,334
    • Karma: 52,172
    • Last Action: 5 hours
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 22:25:47 - 04/11/24 (1 month ago)
    Post link copied to clipboard Copy post link

    splent [2088243]

    Hey everyone, several fixes and smaller improvements today: 

    • Added 'rarity' field ("yellow", "orange", "red" or null) to 'user' -> 'itemmarket' and 'market' -> 'itemmarket' selections
    • The "item" field should now always be populated in "market' -> 'itemmarket' even if there are no listings
    • Added a few more bonus filters: "Any", "Double", "Yellow", "Orange" & "Red"
    • The 'torn' -> 'itemstats' will now return "0" for "owner_id" if the item is being sold anonymously on market OR if it was never used
    • Fixed 'user' -> 'hof' selection from returning incorrect values for some players
    • Weapon bonuses in Swagger are now sorted alphabetically (lol i know it was important to some)

     

    As always, Swagger schema is updated to reflect these changes.


    Important note!

    We'll be closing 'market' -> 'bazaar' selection in two weeks, as it doesn't serve much purpose currently.

    I know instead many would rather if we added global cache and bazaar owner information to this selection, but unfortunately, because this information is no longer visible anywhere else in Torn it needs to be removed.
    However, as soon as, or, if bazaars appear somewhere else in Torn, I'll be more than happy to prioritize that and create a relatable selection ASAP.

    Thanks!


    How you gonna call kneecapping us an improvement? Hopefully someone builds an entire addon to replace it I guess.

     

    • tiksan [2383326]
    • Role: Civilian
    • Level: 100
    • Posts: 947
    • Karma: 1,257
    • Last Action: 1 minute
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 00:42:58 - 05/11/24 (1 month ago)
    Post link copied to clipboard Copy post link

    splent [2088243]

    Hey everyone, several fixes and smaller improvements today: 

    • Added 'rarity' field ("yellow", "orange", "red" or null) to 'user' -> 'itemmarket' and 'market' -> 'itemmarket' selections
    • The "item" field should now always be populated in "market' -> 'itemmarket' even if there are no listings
    • Added a few more bonus filters: "Any", "Double", "Yellow", "Orange" & "Red"
    • The 'torn' -> 'itemstats' will now return "0" for "owner_id" if the item is being sold anonymously on market OR if it was never used
    • Fixed 'user' -> 'hof' selection from returning incorrect values for some players
    • Weapon bonuses in Swagger are now sorted alphabetically (lol i know it was important to some)

     

    As always, Swagger schema is updated to reflect these changes.


    Important note!

    We'll be closing 'market' -> 'bazaar' selection in two weeks, as it doesn't serve much purpose currently.

    I know instead many would rather if we added global cache and bazaar owner information to this selection, but unfortunately, because this information is no longer visible anywhere else in Torn it needs to be removed.
    However, as soon as, or, if bazaars appear somewhere else in Torn, I'll be more than happy to prioritize that and create a relatable selection ASAP.

    Thanks!


    Beerstein [1322136]

    How you gonna call kneecapping us an improvement? Hopefully someone builds an entire addon to replace it I guess.

    This endpoint is useless currently. The endpoint doesn't show user IDs and we can't view users' bazaars easily on item market 2.0, so there's not really a reason to use it. Plus generally, the devs only allow API endpoints only show data that's available in-game which this isn't really. All of the current bazaar-related tools use user/bazaar not market/bazaar.  There isn't really any kneecapping going on here.

    LnNwLrL.gif

    • Kwack [2190604]
    • Role: Civilian
    • Level: 15
    • Posts: 2,137
    • Karma: 3,448
    • Last Action: 4 hours
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 01:51:43 - 05/11/24 (1 month ago)
    Post link copied to clipboard Copy post link

    splent [2088243]

    Hey everyone, several fixes and smaller improvements today: 

    • Added 'rarity' field ("yellow", "orange", "red" or null) to 'user' -> 'itemmarket' and 'market' -> 'itemmarket' selections
    • The "item" field should now always be populated in "market' -> 'itemmarket' even if there are no listings
    • Added a few more bonus filters: "Any", "Double", "Yellow", "Orange" & "Red"
    • The 'torn' -> 'itemstats' will now return "0" for "owner_id" if the item is being sold anonymously on market OR if it was never used
    • Fixed 'user' -> 'hof' selection from returning incorrect values for some players
    • Weapon bonuses in Swagger are now sorted alphabetically (lol i know it was important to some)

     

    As always, Swagger schema is updated to reflect these changes.


    Important note!

    We'll be closing 'market' -> 'bazaar' selection in two weeks, as it doesn't serve much purpose currently.

    I know instead many would rather if we added global cache and bazaar owner information to this selection, but unfortunately, because this information is no longer visible anywhere else in Torn it needs to be removed.
    However, as soon as, or, if bazaars appear somewhere else in Torn, I'll be more than happy to prioritize that and create a relatable selection ASAP.

    Thanks!


    Instead of fully deleting, could you deprecate and instead just return an empty array?

     

    This shouldn't break any apps (given that an empty array was already possible if none were on the market) but removes the information from the call.

    • splent [2088243]
    • Role: Admin
    • Level: 95
    • Posts: 736
    • Karma: 2,032
    • Last Action: 3 hours
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 09:29:18 - 05/11/24 (1 month ago)
    Post link copied to clipboard Copy post link

    splent [2088243]

    Hey everyone, several fixes and smaller improvements today: 

    • Added 'rarity' field ("yellow", "orange", "red" or null) to 'user' -> 'itemmarket' and 'market' -> 'itemmarket' selections
    • The "item" field should now always be populated in "market' -> 'itemmarket' even if there are no listings
    • Added a few more bonus filters: "Any", "Double", "Yellow", "Orange" & "Red"
    • The 'torn' -> 'itemstats' will now return "0" for "owner_id" if the item is being sold anonymously on market OR if it was never used
    • Fixed 'user' -> 'hof' selection from returning incorrect values for some players
    • Weapon bonuses in Swagger are now sorted alphabetically (lol i know it was important to some)

     

    As always, Swagger schema is updated to reflect these changes.


    Important note!

    We'll be closing 'market' -> 'bazaar' selection in two weeks, as it doesn't serve much purpose currently.

    I know instead many would rather if we added global cache and bazaar owner information to this selection, but unfortunately, because this information is no longer visible anywhere else in Torn it needs to be removed.
    However, as soon as, or, if bazaars appear somewhere else in Torn, I'll be more than happy to prioritize that and create a relatable selection ASAP.

    Thanks!


    Kwack [2190604]

    Instead of fully deleting, could you deprecate and instead just return an empty array?

     

    This shouldn't break any apps (given that an empty array was already possible if none were on the market) but removes the information from the call.

    Smart, yeah let’s do that instead! Thanks! :)

    • splent [2088243]
    • Role: Admin
    • Level: 95
    • Posts: 736
    • Karma: 2,032
    • Last Action: 3 hours
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 11:27:50 - 05/11/24 (1 month ago)
    Post link copied to clipboard Copy post link

    Hey everyone,

     

    I need to deploy some likely breaking changes in API v2 (but just in API v2, API v1 will continue to function normally).

    I'm making changes to the service processing API requests to fix Swagger code-gen issue, so we can can also allow requests in this format: 
    "/v2/market/2/itemmarket,timestamp?key="
    "/v2/market/2/itemmarket/?key="

    The issue here is that API v1 uses "ID", and API v2 uses "id" internally, so, in the example above /2/ part becomes "id=2" and no longer "ID=2". This inevitably breaks those selections in API v2 that have not yet been modified (e.g. 'user' -> 'basic').

    So, to sum up with a few examples, after this change (in API v2), these will work:

    • /v2/market/5/itemmarket,timestamp
    • /v2/market/itemmarket,timestamp?id=5
    • /v2/market/5?selections=itemmarket,timestamp
    • /v2/market?selections=itemmarket,timestamp&id=5

    These changes done a week ago will no longer work: 

    • /v2/market/itemmarket,timestamp/5


    Edit: This striked through are no longer true:

    Additionally, any selection not yet updated in API v2, won't be able to use ID in path either, so this for example:

    • /v2/user/1/basic,timestamp

    Will actually behave as if "ID" was not set, and will default to key owner's profile.

    Same will happen with other selections that have not been updated in v2 yet, so you'll need to use v1 for them.

     

    This change is already tested and ready to be merged, but I'll deploy it this Thursday, November 7th, just to give everyone at least a little bit of time to prepare/update any code they need to.

    After that, I'll be updating all Swagger endpoints (fixing some smaller issues, e.g. using "_metadata" instead of "_links") and I'll be tagging them with "Stable" or "Unstable" tags.

     

    Here's a preview on how endpoints will look like:
    TH75dpqbScmG1n2-cm87zw.png
    Thanks for understanding, and sorry about any confusion or problems these changes might've caused!

    Last edited by splent on 12:29:19 - 11/11/24 (1 month ago)
    • splent [2088243]
    • Role: Admin
    • Level: 95
    • Posts: 736
    • Karma: 2,032
    • Last Action: 3 hours
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 15:32:21 - 08/11/24 (1 month ago)
    Post link copied to clipboard Copy post link

    Hey everyone, the big Swagger change is finally here. Here's the summary:

    • Replaced all link generation to create links and place "id" or "ids" as path parameters instead of as query parameters
    • Added 'bonus' query parameter to 'market' -> 'itemmarket' selection (parameter "cat" is now deprecated)
    • Added '_metadata' to 'forum' -> 'threads' (response field "_links" is now deprecated)
    • Added '_metadata' to 'racing' -> 'races'
    • Added '_metadata' to 'torn' -> 'hof' (response field "_links" is now deprecated)
    • Added '_metadata' to 'torn' -> 'factionhof' (response field "_links" is now deprecated)
    • Improved 'user' -> 'races' selection to also look into the log tables
    • Added '_metadata' to 'user' -> 'races'
    • Added '_metadata' to 'user' -> 'forumposts' (response field "_links" is now deprecated)
    • Added '_metadata' to 'user' -> 'forumthreads' (response field "_links" is now deprecated)
    • Fixed Swagger response for 'user' -> 'races' & 'user' -> 'enlistedcars' selections
    • Refactored all Swagger endpoints and removed query parameters from path (thanks @MAVRI)
    • Added "Stable" & "Unstable" to all endpoints. Stable endpoints are not expected to have sudden changes (all future changes will be announced in this thread & with "deprecated" attribute)
    • Added a generic endpoint for every section which can take any selections as input 
    • Updated service processing requests to allow requests to be in the new format (/v2/section/id/selections/)

     

    It's possible I've missed something during testing so if you notice any Swagger schema not matching the response or just something off & not working in general, please do let me know so I can fix it ASAP.

     

    Link to Swagger: https://www.torn.com/swagger/index.html#/

    Thanks!

    Last edited by splent on 12:29:47 - 11/11/24 (1 month ago)
    • CurlyBracket [2766476]
    • Role: Civilian
    • Level: 82
    • Posts: 879
    • Karma: 876
    • Last Action: 49 minutes
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 19:04:33 - 08/11/24 (1 month ago)
    Post link copied to clipboard Copy post link

    Maybe I'm being dense, but the last update seemed somewhat contradictory.  First, you say that the last update:

      

    Replaced all link generation to create links and place "id" or "ids" as path parameters instead of as query parameters

     

    My read of that is that you changed the code generation so that when you send back links (e.g. a next/prev link in _metadata), you will send back links that include the id as a path parameter instead of a query parameter (e.d. /v2/user/2 instead of /v2/user?id=2).

     

    But the you write that:

    Additionally, any selection not yet updated in API v2, won't be able to use ID in path either, so this for example:

    • /v2/user/1/basic,timestamp

    Will actually behave as if "ID" was not set, and will default to key owner's profile.

     

    My read of this is that the v2 protocol is shifting away from using id as a path parameter, and instead using it as a query param.

     

    So I just want to be clear - which is the preferred way to indicate the id in v2 - As a path param or as a query param?

    • splent [2088243]
    • Role: Admin
    • Level: 95
    • Posts: 736
    • Karma: 2,032
    • Last Action: 3 hours
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 23:15:28 - 08/11/24 (1 month ago)
    Post link copied to clipboard Copy post link

    CurlyBracket [2766476]

    Maybe I'm being dense, but the last update seemed somewhat contradictory.  First, you say that the last update:

      

    Replaced all link generation to create links and place "id" or "ids" as path parameters instead of as query parameters

     

    My read of that is that you changed the code generation so that when you send back links (e.g. a next/prev link in _metadata), you will send back links that include the id as a path parameter instead of a query parameter (e.d. /v2/user/2 instead of /v2/user?id=2).

     

    But the you write that:

    Additionally, any selection not yet updated in API v2, won't be able to use ID in path either, so this for example:

    • /v2/user/1/basic,timestamp

    Will actually behave as if "ID" was not set, and will default to key owner's profile.

     

    My read of this is that the v2 protocol is shifting away from using id as a path parameter, and instead using it as a query param.

     

    So I just want to be clear - which is the preferred way to indicate the id in v2 - As a path param or as a query param?

    Great question. I see how it could be confusing. Let me explain in a bit more detail.

    So, internally, API v1 uses "ID". This "ID" is set as a path parameter, e.g. "v1/user/1".

    On the other hand, API v2 internally uses a different parameter, called "id". This "id" could previously be set only as a query parameter, e.g.  "v1/user?id=1", so you're reading this first part correctly:

    My read of that is that you changed the code generation so that when you send back links (e.g. a next/prev link in _metadata), you will send back links that include the id as a path parameter instead of a query parameter (e.d. /v2/user/2 instead of /v2/user?id=2).


    However, previously, if you did something like "v2/faction/8500?selections=basic&id=8510", the service processing the request would cache two different ids, ID 8500 and id 8510. This also made some other things a bit harder to do. 

    With the latest changes, if you make a request like this: "v2/faction/8500?selections=basic&id=8510", only one "id" is set, the 8500 one.
    However, if you really prefer, you could also pass id only as a query parameter, but if the path id parameter is present, it will always override the query parameter.

    --

    Which brings me to this part of my previous comment: 

    Additionally, any selection not yet updated in API v2, won't be able to use ID in path either, so this for example:

    • /v2/user/1/basic,timestamp

    Will actually behave as if "ID" was not set, and will default to key owner's profile.


    API v2 selections that haven't been explicitly modified will by default fallback to API v1 response.
    Because of that, and because ID is no longer being set in API v2, this means that basically all selections in API v2 that haven't been explicitly modified will behave as no "ID" in API v1 was set.
    So sorry about the confusion with this comment. I sometimes forget others are not inside of my head and don't know everything I do.
    I just wanted to say that selections in API v2 that have not been processed won't work properly anymore (but I'll see on Monday if I can make a quick fix for this).

     

    So I just want to be clear - which is the preferred way to indicate the id in v2 - As a path param or as a query param?

    Path parameter is preferred (as _metadata links show), but you're free to use "id" as query parameter if you desire. I want the API v2 to be flexible so it's easier for others to work with it.

    Hopefully this shines some light on how everything works. 

    Let me know if I should explain more.

    Thanks!

     

    • CurlyBracket [2766476]
    • Role: Civilian
    • Level: 82
    • Posts: 879
    • Karma: 876
    • Last Action: 49 minutes
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 23:31:14 - 08/11/24 (1 month ago)
    Post link copied to clipboard Copy post link

    CurlyBracket [2766476]

    Maybe I'm being dense, but the last update seemed somewhat contradictory.  First, you say that the last update:

      

    Replaced all link generation to create links and place "id" or "ids" as path parameters instead of as query parameters

     

    My read of that is that you changed the code generation so that when you send back links (e.g. a next/prev link in _metadata), you will send back links that include the id as a path parameter instead of a query parameter (e.d. /v2/user/2 instead of /v2/user?id=2).

     

    But the you write that:

    Additionally, any selection not yet updated in API v2, won't be able to use ID in path either, so this for example:

    • /v2/user/1/basic,timestamp

    Will actually behave as if "ID" was not set, and will default to key owner's profile.

     

    My read of this is that the v2 protocol is shifting away from using id as a path parameter, and instead using it as a query param.

     

    So I just want to be clear - which is the preferred way to indicate the id in v2 - As a path param or as a query param?

    splent [2088243]

    Great question. I see how it could be confusing. Let me explain in a bit more detail.

    So, internally, API v1 uses "ID". This "ID" is set as a path parameter, e.g. "v1/user/1".

    On the other hand, API v2 internally uses a different parameter, called "id". This "id" could previously be set only as a query parameter, e.g.  "v1/user?id=1", so you're reading this first part correctly:

    My read of that is that you changed the code generation so that when you send back links (e.g. a next/prev link in _metadata), you will send back links that include the id as a path parameter instead of a query parameter (e.d. /v2/user/2 instead of /v2/user?id=2).


    However, previously, if you did something like "v2/faction/8500?selections=basic&id=8510", the service processing the request would cache two different ids, ID 8500 and id 8510. This also made some other things a bit harder to do. 

    With the latest changes, if you make a request like this: "v2/faction/8500?selections=basic&id=8510", only one "id" is set, the 8500 one.
    However, if you really prefer, you could also pass id only as a query parameter, but if the path id parameter is present, it will always override the query parameter.

    --

    Which brings me to this part of my previous comment: 

    Additionally, any selection not yet updated in API v2, won't be able to use ID in path either, so this for example:

    • /v2/user/1/basic,timestamp

    Will actually behave as if "ID" was not set, and will default to key owner's profile.


    API v2 selections that haven't been explicitly modified will by default fallback to API v1 response.
    Because of that, and because ID is no longer being set in API v2, this means that basically all selections in API v2 that haven't been explicitly modified will behave as no "ID" in API v1 was set.
    So sorry about the confusion with this comment. I sometimes forget others are not inside of my head and don't know everything I do.
    I just wanted to say that selections in API v2 that have not been processed won't work properly anymore (but I'll see on Monday if I can make a quick fix for this).

     

    So I just want to be clear - which is the preferred way to indicate the id in v2 - As a path param or as a query param?

    Path parameter is preferred (as _metadata links show), but you're free to use "id" as query parameter if you desire. I want the API v2 to be flexible so it's easier for others to work with it.

    Hopefully this shines some light on how everything works. 

    Let me know if I should explain more.

    Thanks!

     

    OK...to summarize (and add a little specificity):

     

    1) v1 API gets the ID from the path and the selections from query params

    2) v2 API can get the ID from either the path or from an id=## query param, and selections either from the path (after the ID) or in query params

    3) In v2, if an ID was passed both in the path and in a query param, the path ID wins.

    4) Some of the v2 APIs have not yet been updated, and so if you pass the selections as a path arg, it will ignore the ID in the path.

     a) question: if you want to set the ID, you must do it with a query arg?  or can you set it in the path as long as selections is a query arg?

     a) question: I assume that all v2 APIs will eventually work as described in #2, no?

     

    Is that correct?

    • splent [2088243]
    • Role: Admin
    • Level: 95
    • Posts: 736
    • Karma: 2,032
    • Last Action: 3 hours
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 12:27:31 - 11/11/24 (1 month ago)
    Post link copied to clipboard Copy post link

    Hey everyone,

     

    It seems that this change was a point of confusion: 

    Additionally, any selection not yet updated in API v2, won't be able to use ID in path either, so this for example:

    • /v2/user/1/basic,timestamp

    Will actually behave as if "ID" was not set, and will default to key owner's profile.

    Same will happen with other selections that have not been updated in v2 yet, so you'll need to use v1 for them.


    so I've added some additional logic to fix this, and now these endpoints will be working again as before:

    https://api.torn.com/v2/user/1/profile,timestamp?key= 


    My bad there, I probably could've done this right away, but I missed it would cause so many issues even with being announced upfront.

    Thanks for understanding!

    • splent [2088243]
    • Role: Admin
    • Level: 95
    • Posts: 736
    • Karma: 2,032
    • Last Action: 3 hours
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 16:19:01 - 11/11/24 (1 month ago)
    Post link copied to clipboard Copy post link

    Another small update today,

    I added "lookup" endpoints to all Swagger sections. 

    Additionally, Swagger path parameter "categoryIds" in 'forum' -> 'threads' selection got updated (previously "integer" now "array of integers".

    Make sure to hard refresh Swagger (if you're not seeing them, make sure to clear cache on both Swagger page and openapi.json file).

    Thanks

    Last edited by splent on 16:20:59 - 11/11/24 (1 month ago)
    • Skeletron [318855]
    • Role: Civilian
    • Level: 100
    • Posts: 687
    • Karma: 1,964
    • Last Action: 2 hours
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 03:19:29 - 12/11/24 (1 month ago)
    Post link copied to clipboard Copy post link

    splent [2088243]

    Hey everyone,

     

    It seems that this change was a point of confusion: 

    Additionally, any selection not yet updated in API v2, won't be able to use ID in path either, so this for example:

    • /v2/user/1/basic,timestamp

    Will actually behave as if "ID" was not set, and will default to key owner's profile.

    Same will happen with other selections that have not been updated in v2 yet, so you'll need to use v1 for them.


    so I've added some additional logic to fix this, and now these endpoints will be working again as before:

    https://api.torn.com/v2/user/1/profile,timestamp?key= 


    My bad there, I probably could've done this right away, but I missed it would cause so many issues even with being announced upfront.

    Thanks for understanding!

    Hello splent,

     

    Does this change /v2/user/{crimeId}/crimes

     

    I'm getting error 17.

     

    Thanks

    • splent [2088243]
    • Role: Admin
    • Level: 95
    • Posts: 736
    • Karma: 2,032
    • Last Action: 3 hours
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 10:38:18 - 12/11/24 (1 month ago)
    Post link copied to clipboard Copy post link

    splent [2088243]

    Hey everyone,

     

    It seems that this change was a point of confusion: 

    Additionally, any selection not yet updated in API v2, won't be able to use ID in path either, so this for example:

    • /v2/user/1/basic,timestamp

    Will actually behave as if "ID" was not set, and will default to key owner's profile.

    Same will happen with other selections that have not been updated in v2 yet, so you'll need to use v1 for them.


    so I've added some additional logic to fix this, and now these endpoints will be working again as before:

    https://api.torn.com/v2/user/1/profile,timestamp?key= 


    My bad there, I probably could've done this right away, but I missed it would cause so many issues even with being announced upfront.

    Thanks for understanding!

    Skeletron [318855]

    Hello splent,

     

    Does this change /v2/user/{crimeId}/crimes

     

    I'm getting error 17.

     

    Thanks

    I think this should be fixed now. 

    Let me know if you experience any more issue. 


    Thanks!

    • jtower [2287159]
    • Role: Civilian
    • Level: 100
    • Posts: 1,226
    • Karma: 1,443
    • Last Action: 1 minute
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 15:26:17 - 12/11/24 (1 month ago)
    Post link copied to clipboard Copy post link

    https://api.torn.com/v2/market/2?selections=itemmarket&limit=1&key=

     

    The "limit" attribute here should limit the listings to just 1 item, but it seems it does not have effects here.

     

    It works for other things, like https://api.torn.com/v2/market/?selections=pointsmarket&limit=2&key=

     

    I'm assuming it's because the listings attribute is nested? But i just wanted to let you know.

     

     

     

    BTW, is this the right place for v2 api bugs or should we open a new thread in the bug section? I'll create a new thread, if this doesn't belong here.

    • DeKleineKobini [2114440]
    • Role: Committee
    • Level: 100
    • Posts: 3,789
    • Karma: 5,409
    • Last Action: 5 hours
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 16:49:41 - 12/11/24 (1 month ago)
    Post link copied to clipboard Copy post link

    jtower [2287159]

    https://api.torn.com/v2/market/2?selections=itemmarket&limit=1&key=

     

    The "limit" attribute here should limit the listings to just 1 item, but it seems it does not have effects here.

     

    It works for other things, like https://api.torn.com/v2/market/?selections=pointsmarket&limit=2&key=

     

    I'm assuming it's because the listings attribute is nested? But i just wanted to let you know.

     

     

     

    BTW, is this the right place for v2 api bugs or should we open a new thread in the bug section? I'll create a new thread, if this doesn't belong here.

    It's not listed in the swagger specs, so doesn't seem like a bug.

    • jtower [2287159]
    • Role: Civilian
    • Level: 100
    • Posts: 1,226
    • Karma: 1,443
    • Last Action: 1 minute
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 20:14:33 - 12/11/24 (1 month ago)
    Post link copied to clipboard Copy post link

    If it's not a bug the fact that the limit attribute does not work for the itemmarket selection, then it should be a bug the fact the it works for pointsmarket? lol

     

    Anyway, the limit attribute works for v1. Is it something that it's going to be implemented in v2 as well?

    • splent [2088243]
    • Role: Admin
    • Level: 95
    • Posts: 736
    • Karma: 2,032
    • Last Action: 3 hours
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 00:07:32 - 13/11/24 (1 month ago)
    Post link copied to clipboard Copy post link

    jtower [2287159]

    If it's not a bug the fact that the limit attribute does not work for the itemmarket selection, then it should be a bug the fact the it works for pointsmarket? lol

     

    Anyway, the limit attribute works for v1. Is it something that it's going to be implemented in v2 as well?

    The API v2 is in general much more documented than API v1.

    You can view all currently available selections/endpoints and query parameters in API v2 here: https://www.torn.com/swagger/index.html

    The 'market' -> 'itemmarket' selection is currently tagged as "Unstable", which means it's still being worked on. So at the moment I can say it's possible that "limit" query parameter will also be added there as a part of a future update.

    Also, a comment on this:

    then it should be a bug the fact the it works [limit] for pointsmarket? lol


    Not all selections are uniform and can operate on the same standard, so one things doesn't automatically make the other a bug. Especially if one is part of API v1 and the other of the API v2.
    Regardless though, if you have suggestions on how to improve the API, they're more than welcome.

    BTW, is this the right place for v2 api bugs or should we open a new thread in the bug section? I'll create a new thread, if this doesn't belong here.

    It's preferred to create new bug reports as it's easier to track everything internally.


    Thanks!

    • jtower [2287159]
    • Role: Civilian
    • Level: 100
    • Posts: 1,226
    • Karma: 1,443
    • Last Action: 1 minute
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 15:49:48 - 13/11/24 (1 month ago)
    Post link copied to clipboard Copy post link

    jtower [2287159]

    If it's not a bug the fact that the limit attribute does not work for the itemmarket selection, then it should be a bug the fact the it works for pointsmarket? lol

     

    Anyway, the limit attribute works for v1. Is it something that it's going to be implemented in v2 as well?

    splent [2088243]

    The API v2 is in general much more documented than API v1.

    You can view all currently available selections/endpoints and query parameters in API v2 here: https://www.torn.com/swagger/index.html

    The 'market' -> 'itemmarket' selection is currently tagged as "Unstable", which means it's still being worked on. So at the moment I can say it's possible that "limit" query parameter will also be added there as a part of a future update.

    Also, a comment on this:

    then it should be a bug the fact the it works [limit] for pointsmarket? lol


    Not all selections are uniform and can operate on the same standard, so one things doesn't automatically make the other a bug. Especially if one is part of API v1 and the other of the API v2.
    Regardless though, if you have suggestions on how to improve the API, they're more than welcome.

    BTW, is this the right place for v2 api bugs or should we open a new thread in the bug section? I'll create a new thread, if this doesn't belong here.

    It's preferred to create new bug reports as it's easier to track everything internally.


    Thanks!

    Sounds good! I already added a couple of suggestions somewhere, i think in another thread for v2 suggestions if i remember correctly, but it was months ago. The only other one I can think of right now would be for the same topic: the limit attribute in the itemmarket selection, so we can limit the amount of data to expose, download, or bring around

Reply
Thread Title: