Skip to content
TORNLIFE More

Questions about attack data

Started by Aezur [1950769] on in API Development.

5 replies · 139 views · thread synced · 6 days ago · View on torn.com
About this thread

Posts archived: 6 / 6 posts (100%) · the total is Torn's reply count + the opening post at the last fetch

Counted by TornLife from the archived posts.

Archived posts
6
Discussion span
→
People posting
3
Likes on archived posts
6
Posts by staff, officers and moderators
1
Authority score
71 / 100
Historical score
17 / 100
Story score
29 / 100
Engagement score
50 / 100

Most-liked replies

Aezur [1950769]
User 'attacks' & 'attacksfull' come back listed by id or slug or whatever you want to call it. They also contain a 'code'.

There is no way to query attacks as far as I can tell. Why do they have slugs and a code? The slugs make sense from an API design perspective because they need to have a unique key in JSON, but what is the code for? It has to be for something, right? Or else why would it be included in a public API? Is an 'attacks' endpoint in the works?

Also, the data from the 'attacks' response is a different shape to the data from the 'attacksfull' response, but with very little difference. The 'attacks' selection has additional fields for attacker/defender names, attacker/defender faction names, chain number, and a modifiers object.

Why? This is bizarre from an API design perspective. If someone could provide me some insight, or has any knowledge on this, it would be very appreciated.
Kivou [2000607]
The code is the id of the log report.
https://www.torn.com/loader.php?sid=attackLog&ID=<code>

attacks gives more information but only the last 100 attacks
attacksfull gives less information but the last 1000 attacks
Aezur [1950769]
Oh awesome. That code is handy AF then.

In regards to the attacks/attacks full, I guess my comments were more in regards to the API design. Having similar but slightly different structures come back is an odd design choice. My initial thought was that it my be reflective of the underlying database schema, and perhaps those fields get trimmed when attacks are put into LTS, but even that seems a little odd. I guess with so many attacks being generated every second of every day the savings on overheads for trimming a few bytes add up.

Thanks for you response.
Kivou [2000607]
As you'll discover the API, the feeling of odd design choice will come back often ^^

But jokes aside, my understanding of why the API seems messy and inconsistent boils down to:
- API is still beta and not the main dev focus
- Torn's backend seems to be quite complex with heterogeneous bits of codes from different "ages" of the game's development
- The dev team is adding to the API quite quickly most of what we ask them to add

But and the end of the day if we all love to criticize it, we all love it <3
Aezur [1950769]
"But and the end of the day if we all love to criticize it, we all love it <3"

Absolutely! I just started digging into it a few days ago. Does it get updated often? I was thinking about writing some proper documentation for it, but if it's constantly evolving I'm not sure I can commit to that.

Ah, with the lockdown I might end up doing it out of boredom anyway.