Rules around pooling API keys to get information | API Develop…
Rules around pooling API keys to get information
  • SC Transhumanist [2575642]Transhumanist [2575642]
    • Transhumanist [2575642]
    • Role: Civilian
    • Level: 61
    • Posts: 267
    • Karma: 494
    • Last Action: 7 hours
    • Quote
    • Report
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Thread created on 10:41:48 - 04/07/21 (3 months ago)
    |
    Last replied 14:27:55 - 06/07/21 (3 months ago)
    I want to write a discord bot to pull some information but 100 calls per second won't be enough for it. I wanna pool API keys from different users and use them in round robin fashion to get the information I need.
    • What are the rules around this?
    • Can the users get banned because of suspected account sharing ( calls made from the same ip - app running in cloud )
    Last edited by Transhumanist on 13:20:32 - 04/07/21
  • JFK™ Kivou [2000607]Kivou [2000607]
    • Kivou [2000607]
    • Role: Reporter
    • Level: 100
    • Posts: 1599
    • Karma: 2217
    • Last Action: 3 hours
    • Quote
    • Report
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 13:43:29 - 04/07/21 (3 months ago)
    Post link copied to clipboard Copy post link
    As last long as they willingly hand you over their keys and you don't have malicious intents you're good to go.

    Account sharing has nothing to do with the API (otherwise I would have been fedded a million times ^^)

    FJK

  • JFK™ CRLF [2095076]CRLF [2095076]
    • CRLF [2095076]
    • Role: Reporter
    • Level: 89
    • Posts: 7870
    • Karma: 22601
    • Last Action: 4 hours
    • Quote
    • Report
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 05:15:01 - 06/07/21 (3 months ago)
    Post link copied to clipboard Copy post link
    The limit is 100 calls per minute, not per second. 

    Also, for whatever reason, API responses have slowed. I typically get 21-25 calls per minute per key using 13 keys.

    You can see in a thread I posted twelve months ago that I needed to use a sleep command to slow down my job. Otherwise I would have exceeded 100 calls per minute. I have not had to use a sleep command in the last 10 months.

    Actually using multiple keys with the owner's permission is fine. I use a small job first that makes sure all of the key owners are active, as using the key of someone who has been away for a week will generate an error message:

    'The key is temporarily disabled due to owner inactivity': An inactive player's key may not make API calls after 7 days.
  • SC Transhumanist [2575642]Transhumanist [2575642]
    • Transhumanist [2575642]
    • Role: Civilian
    • Level: 61
    • Posts: 267
    • Karma: 494
    • Last Action: 7 hours
    • Quote
    • Report
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 07:44:30 - 06/07/21 (3 months ago)
    Post link copied to clipboard Copy post link
    Thanks for all the inputs guys. Need to handle a lot of scenarios in pooling the keys I guess.
  • JFK™ CRLF [2095076]CRLF [2095076]
    • CRLF [2095076]
    • Role: Reporter
    • Level: 89
    • Posts: 7870
    • Karma: 22601
    • Last Action: 4 hours
    • Quote
    • Report
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 14:27:55 - 06/07/21 (3 months ago)
    Post link copied to clipboard Copy post link

    Transhumanist [2575642]

    Thanks for all the inputs guys. Need to handle a lot of scenarios in pooling the keys I guess.
    The code for looping the keys and making the calls is simple. Processing the return is more work.

    rs4 is my table of keys
    rs1 is my table of player ids I want to process in my job

    Here's the top of one job. You test the keys (I have that as a separate routine called by all of my jobs). You make a list of all of the API keys that passed the test (rs4). Then for each id in your id set (rs1), you build the request string (including one API key)and pass it to the API.

    You then retrieve the API response and make sure it doesn't contain an error code. This job will re-try on error and if it fails three times, I write an error message and move on. The rest is just parsing the response (not shown here).

    This is in VBA for running on an Access db, but the logic is pretty much the same for anything.

Reply
Thread Title: