Mojang Rest API cooldown

Discussion in 'Programming' started by piggysaw, May 9, 2017.

  1. The Mojang REST API only allows me to send requests every 1 minute, I would like to know if they know any alternatives, the OfflinePlayer class of Bukkit I suppose that does something like this but I have been looking at it and it is an interface so I do not understand how it works, there are web applications like that are fast and do not have that cooldown, I would appreciate the help!

  2. Hi friend, do you know anything about this, thank you and sorry for the inconvenience @WAS
  3. namemc cache the results and presumably use a range of IPs that allow them to do more lookups then usually possible. What is your goal?
  4. Basically get the current names through the uuid for web applications
    • Like Like x 1
  5. Thanks api works but it does not work for my project because it does not allow cross origin, I would like to know @mathhulk does to get the information without the cooldown of mojang.

  6. electronicboy

    IRC Staff

    It's quite simple: Mojang have different limits on different API endpoints, some of them, are limited at like 600 requests/10 minutes, others are limited at 1 per minute, it really depends on what you're looking at. However, the basic concept is that you cache the results for a sane amount of time, e.g. Do you really need to check every single second if a player changed their name? (Hint: The answer is generally no)

    These are also per-ip limits, so for larger setups, you'll generally have services sitting on multiple IPs and balance your external requests between them, making sure to cache the results for a sane period of time
    • Like Like x 1
  7. Then you should do to through javascript, get the name of a user through your uuid, mojang has two problems, the first the cooldown and the second the cross-origin, the web you recommended to me works has no cooldown but no Lets cross origin, thanks for the help!
  8. mathhulk

    mathhulk Retired Moderator

    I cache the results like any other API. For example, I save the the requested data in a database and the time it was requested. If it is requested in the next five minutes, let's say, it spits out the database entry. However, when this five minutes is up, it will spit out the Mojang result and save the new data to the database.

    I can also add cross-origin support if you want.
    #9 mathhulk, May 9, 2017
    Last edited: May 9, 2017
    • Like Like x 1
  9. Many thanks to everyone for the serious help !, @mathhulk you can allow cross origin so that conventional browsers can access your API through HXR queries.