Skip to content
TORNLIFE More

API Request - Faction Challenges

Started by MightyGoober [812478] on in Bugs & Issues.

20 replies · 350 views · thread synced · 5 days ago · View on torn.com
About this thread

Posts archived: 21 / 21 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
21
Discussion span
→
Authority score
61 / 100
Historical score
40 / 100
Story score
48 / 100
Engagement score
65 / 100

People posting, likes and official posts are not counted for this thread yet: on threads longer than one page they come from a periodic pass over the archive, which has not covered it.

Most-liked replies

MightyGoober [812478]
Hi,

(API requests are fine to directly make a bug report right?)

I want to pull the steadfast information, for current members (So it does need to return if they are a current member or not)
That way, I (or DocTorn, and other scripts) can add the 4 stats together. Currently, in order to do this it would need 4 non-api requests because this information is not all loaded on the page refresh.

I was wondering if you could add this data into the API. (See screenshot below)

[image: i.imgur.com]
Smokey123 [248901] Helper
Hi Goobs, couldn't you just use the Doctorn feature to 'Export to CSV' or 'Copy Table'?


Edit, ah i just re-read you want current members info only.
Chedburn [1] Admin Developer
I expect I can simply show all faction stats (that are required for challenges) in a single faction API request.

hosps {
[total] = 1234
[user1] = 111
[user2] = 222
[user3] = 333
}

Could work? And hopefully minimal load to grab.
MightyGoober [812478]
Can user 1 be an array?

user1 = array(111, “member”)
user2 = array(222, “not member”)

you can use true/false, 1/0 for member/ not member if you want
Chedburn [1] Admin Developer
That's only for a single stat at a time. There are 43 stats recorded in total.

Why is it so important to have that information immediately visible?
MightyGoober [812478]
I guess it isn’t, makes our side of development easier, but I understand. We can pull the faction member list in a separate call and do the checks ourselves.

ORRRR

Can each user return their faction id?
MightyGoober [812478]
And I assume you would pull each challenge as a separate request

pullIng every branch, every challenge is extreme for 1 call.

the way I see it, I would make 4 API calls, in order to get information about str, speed, dex, def challenges
CRLF [2095076]
You can do a workaround by pulling a list of current faction members. then join that list to the DocTorn export.

You can join the two tables with an inner join in a database, or in Excel you can do a VLOOKUP of current member IDs on the Doctorn list.

Bottom line, unless you're doing something requiring millions of API calls, the 100-per-minute constraint will still allow you to process data quickly. One thousand calls can be done in just over 10 minutes. Embed a SLEEP call in your code to ensure you are maintaining a steady rate of 95-98 calls per minute and Bob's your uncle.

Let me know if you need help on the development side. I'm all for expanding API capabilities if it provides value, but for developer convenience there's usually a way to deal with it as-is.
Chedburn [1] Admin Developer
I've added this in under a 'contributors' selection, it won't be live until the 14th. The stat can be specified with '&stat=hosps'.

Here's an example of how it currently appears, will that work?

[image: i.gyazo.com]
Mauk [1494436]
What are the possible stats?

I actually would've preferred it without the `in_faction` since it's easily cross-referenceable with `basic` in a single call, but yeah, option 2 for me too.
MightyGoober [812478]
Yeah, this is great!!
in_faction is great, otherwise the players faction ID would have been just as good.

Thank you so much, I can see all the big 3rd party tools using this once it's live
Chedburn [1] Admin Developer
All of these will be available via 'faction' => 'contributions' on the 14th Jan. Can use '&stat=X' to grab the one you want.

However, the caching system may immediately break it when it's live, we'll have to see.


medicalitemsused
criminaloffences
organisedcrimerespect
organisedcrimemoney
organisedcrimesuccess
organisedcrimefail
attackswon
attackslost
attackschain
attacksleave
attacksmug
attackshosp
bestchain
busts
revives
jails
hosps
medicalitemrecovery
medicalcooldownused
gymtrains
gymstrength
gymspeed
gymdefense
gymdexterity
candyused
alcoholused
energydrinkused
drugsused
drugoverdoses
rehabs
caymaninterest
traveltimes
traveltime
hunting
attacksdamagehits
attacksdamage
hosptimegiven
hosptimereceived
attacksdamaging
attacksrunaway
highestterritories
territoryrespect
MightyGoober [812478]
Can you post a few previews of these

organisedcrimerespect
organisedcrimemoney
organisedcrimesuccess
organisedcrimefail
highestterritories
territoryrespect

As far as I know, they are not challenges and don't have contributors.
Potentially interesting set of data here.