docs/en/api.html
2024-03-12 02:18:01 +00:00

365 lines
16 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html class="writer-html5" lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Ely.by API (Mojang API simulation) — Ely.by Docs</title>
<link rel="stylesheet" href="/_static/css/theme.css" type="text/css">
<link rel="stylesheet" href="/_static/pygments.css" type="text/css">
<link rel="stylesheet" href="/_static/style.css" type="text/css">
<link rel="shortcut icon" href="/_static/favicon.ico">
<!--[if lt IE 9]>
<script src="_static/js/html5shiv.min.js"></script>
<![endif]-->
<script type="text/javascript" id="documentation_options" data-url_root="./" src="/en/_static/documentation_options.js"></script>
<script src="/_static/jquery.js"></script>
<script src="/_static/underscore.js"></script>
<script src="/_static/doctools.js"></script>
<script type="text/javascript" src="/_static/js/theme.js"></script>
<link rel="index" title="Index" href="/en/genindex.html">
<link rel="search" title="Search" href="/en/search.html">
<link rel="next" title="Authlib-injector" href="/en/authlib-injector.html">
<link rel="prev" title="Welcome to the Ely.by documentation!" href="/en/index.html">
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search">
<a href="/en/index.html" class="icon icon-home"> Ely.by Documentation
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="/en/search.html" method="get">
<input type="text" name="q" placeholder="Search docs">
<input type="hidden" name="check_keywords" value="yes">
<input type="hidden" name="area" value="default">
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<p class="caption"><span class="caption-text">English articles:</span></p>
<ul class="current">
<li class="toctree-l1 current"><a class="current reference internal" href="#">Ely.by API (Mojang API simulation)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#id1">Requests</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#uuid">UUID by username at a time</a></li>
<li class="toctree-l3"><a class="reference internal" href="#id2">Username by UUID + history of changes</a></li>
<li class="toctree-l3"><a class="reference internal" href="#id3">Usernames list to their UUIDs</a></li>
<li class="toctree-l3"><a class="reference internal" href="#id4">Profile info by UUID</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#id5">Possible errors</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#illegalargumentexception">IllegalArgumentException</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="/en/authlib-injector.html">Authlib-injector</a></li>
<li class="toctree-l1"><a class="reference internal" href="/en/minecraft-auth.html">Authentication for Minecraft</a></li>
<li class="toctree-l1"><a class="reference internal" href="/en/oauth.html">Authorization via OAuth2 protocol</a></li>
<li class="toctree-l1"><a class="reference internal" href="/en/skins-system.html">Skins system</a></li>
</ul>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<p class="caption"><span class="caption-text">Статьи на русском:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="/ru/api.html">Ely.by API (симуляция Mojang API)</a></li>
<li class="toctree-l1"><a class="reference internal" href="/ru/authlib-injector.html">Authlib-injector</a></li>
<li class="toctree-l1"><a class="reference internal" href="/ru/minecraft-auth.html">Авторизация для Minecraft</a></li>
<li class="toctree-l1"><a class="reference internal" href="/ru/oauth.html">Авторизация по протоколу OAuth2</a></li>
<li class="toctree-l1"><a class="reference internal" href="/ru/skins-system.html">Система скинов</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="/en/index.html">Ely.by Documentation</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="/en/index.html" class="icon icon-home"></a> »</li>
<li>Ely.by API (Mojang API simulation)</li>
<li class="wy-breadcrumbs-aside">
</li>
</ul>
<hr>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="ely-by-api-mojang-api">
<h1>Ely.by API (Mojang API simulation)<a class="headerlink" href="#ely-by-api-mojang-api" title="Permalink to this headline"></a></h1>
<p>This article contains information about the API compatible with the <a class="reference external" href="http://wiki.vg/Mojang_API">Mojang API</a> functionality. Please note that this is not a full-fledged API of Ely.by, but only a set of additional requests implemented based on our <a class="reference internal" href="/en/minecraft-auth.html"><span class="doc">authorization server</span></a>.</p>
<div class="section" id="id1">
<h2>Requests<a class="headerlink" href="#id1" title="Permalink to this headline"></a></h2>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>The API has no rate limit. We just have a configured fail2ban that will ban especially annoying clients. Thats the way.</p>
</div>
<p>This section will describe the requests and their corresponding variants for Mojang API. Base URL for requests is <code class="docutils literal notranslate"><span class="pre">https://authserver.ely.by</span></code>.</p>
<div class="section" id="uuid">
<h3>UUID by username at a time<a class="headerlink" href="#uuid" title="Permalink to this headline"></a></h3>
<p>This request allows you to find out the UUID of a user by their username at a specified point in time. The time is specified via GET parameter at as a Unix timestamp.</p>
<dl class="py function">
<dt>
<code class="sig-name descname"><span class="pre">GET</span> <span class="pre">/api/users/profiles/minecraft/{username}</span></code></dt>
<dd><p>Where <a href="#id1"><span class="problematic" id="id2">``</span></a>{username} is the searched username. It can be passed in any case (in the Mojang API, only strict match).</p>
<p>Note that the legacy and demo params will never be returned, as these parameters have no alternative in Ely and are specific only for Mojang services.</p>
</dd></dl>
<p>In case of a successful request you will receive the following response:</p>
<div class="highlight-javascript notranslate"><div class="highlight"><pre><span></span><span class="p">{</span>
<span class="s2">"id"</span><span class="o">:</span> <span class="s2">"ffc8fdc95824509e8a57c99b940fb996"</span><span class="p">,</span>
<span class="s2">"name"</span><span class="o">:</span> <span class="s2">"ErickSkrauch"</span>
<span class="p">}</span>
</pre></div>
</div>
<p>When the passed username isnt found, you will receive a response with <code class="docutils literal notranslate"><span class="pre">204</span></code> status code and an empty body.</p>
</div>
<div class="section" id="id2">
<h3>Username by UUID + history of changes<a class="headerlink" href="#id2" title="Permalink to this headline"></a></h3>
<p>This request allows you to find out all usernames used by a user by their UUID.</p>
<dl class="py function">
<dt>
<code class="sig-name descname"><span class="pre">GET</span> <span class="pre">/api/user/profiles/{uuid}/names</span></code></dt>
<dd><p>Where <code class="docutils literal notranslate"><span class="pre">{uuid}</span></code> is a valid UUID. UUID might be written with or without hyphens. If an invalid string is passed, <a class="reference internal" href="#illegalargumentexception">IllegalArgumentException</a> will be returned with the message <code class="docutils literal notranslate"><span class="pre">"Invalid</span> <span class="pre">uuid</span> <span class="pre">format."</span></code>.</p>
</dd></dl>
<p>In case of a successful request you will receive the following response:</p>
<div class="highlight-javascript notranslate"><div class="highlight"><pre><span></span><span class="p">[</span>
<span class="p">{</span>
<span class="s2">"name"</span><span class="o">:</span> <span class="s2">"Admin"</span>
<span class="p">},</span>
<span class="p">{</span>
<span class="s2">"name"</span><span class="o">:</span> <span class="s2">"ErickSkrauch"</span><span class="p">,</span>
<span class="s2">"changedToAt"</span><span class="o">:</span> <span class="mf">1440707723000</span>
<span class="p">}</span>
<span class="p">]</span>
</pre></div>
</div>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Since Ely.by doesnt store the moment of username change only 1 username will always be returned. We may add full support for remembering when a username was changed in the future.</p>
</div>
<p>When the passed UUID isnt found, you will receive a response with <code class="docutils literal notranslate"><span class="pre">204</span></code> status code and an empty body.</p>
</div>
<div class="section" id="id3">
<h3>Usernames list to their UUIDs<a class="headerlink" href="#id3" title="Permalink to this headline"></a></h3>
<p>This request allows you to query a list of users UUIDs by their usernames.</p>
<dl class="py function">
<dt>
<code class="sig-name descname"><span class="pre">POST</span> <span class="pre">/api/profiles/minecraft</span></code></dt>
<dd><p>In the request body or POST parameters you need to pass a valid JSON array of the searched usernames.</p>
<p>The array must contain no more than 100 usernames, otherwise <a class="reference internal" href="#illegalargumentexception">IllegalArgumentException</a> will be returned with the message <code class="docutils literal notranslate"><span class="pre">"Not</span> <span class="pre">more</span> <span class="pre">than</span> <span class="pre">that</span> <span class="pre">100</span> <span class="pre">profile</span> <span class="pre">names</span> <span class="pre">per</span> <span class="pre">call</span> <span class="pre">is</span> <span class="pre">allowed."</span></code>. In case the passed string is an invalid JSON object, the same exception will be returned, but with the text <code class="docutils literal notranslate"><span class="pre">"Passed</span> <span class="pre">array</span> <span class="pre">of</span> <span class="pre">profile</span> <span class="pre">names</span> <span class="pre">is</span> <span class="pre">an</span> <span class="pre">invalid</span> <span class="pre">JSON</span> <span class="pre">string."</span></code>.</p>
<p>Example of a request body:</p>
<div class="highlight-javascript notranslate"><div class="highlight"><pre><span></span><span class="p">[</span><span class="s2">"ErickSkrauch"</span><span class="p">,</span> <span class="s2">"EnoTiK"</span><span class="p">,</span> <span class="s2">"KmotherfuckerF"</span><span class="p">]</span>
</pre></div>
</div>
</dd></dl>
<p>In case of a successful request you will receive the following response:</p>
<div class="highlight-javascript notranslate"><div class="highlight"><pre><span></span><span class="p">[</span>
<span class="p">{</span>
<span class="s2">"id"</span><span class="o">:</span> <span class="s2">"ffc8fdc95824509e8a57c99b940fb996"</span><span class="p">,</span>
<span class="s2">"name"</span><span class="o">:</span> <span class="s2">"ErickSkrauch"</span>
<span class="p">},</span>
<span class="p">{</span>
<span class="s2">"id"</span><span class="o">:</span> <span class="s2">"b8407ae8218658ef96bb0cb3813acdfd"</span><span class="p">,</span>
<span class="s2">"name"</span><span class="o">:</span> <span class="s2">"EnoTiK"</span>
<span class="p">},</span>
<span class="p">{</span>
<span class="s2">"id"</span><span class="o">:</span> <span class="s2">"39f42ba723de56d98867eabafc5e8e91"</span><span class="p">,</span>
<span class="s2">"name"</span><span class="o">:</span> <span class="s2">"KmotherfuckerF"</span>
<span class="p">}</span>
<span class="p">]</span>
</pre></div>
</div>
<p>The data is returned in the same order they were requested.</p>
<p>If one of the passed usernames isnt found in the database, no value will be returned for it (it will be skipped). Keep this in mind when parsing the response.</p>
</div>
<div class="section" id="id4">
<h3>Profile info by UUID<a class="headerlink" href="#id4" title="Permalink to this headline"></a></h3>
<p>See the <a class="reference internal" href="/en/minecraft-auth.html#profile-request"><span class="std std-ref">profile request for the authorization server</span></a>.</p>
</div>
</div>
<div class="section" id="id5">
<h2>Possible errors<a class="headerlink" href="#id5" title="Permalink to this headline"></a></h2>
<div class="section" id="illegalargumentexception">
<span id="id6"></span><h3>IllegalArgumentException<a class="headerlink" href="#illegalargumentexception" title="Permalink to this headline"></a></h3>
<p>This error occurs when attempting to send data to the server in an incorrect format.</p>
<p>An error example:</p>
<div class="highlight-javascript notranslate"><div class="highlight"><pre><span></span><span class="p">{</span>
<span class="s2">"error"</span><span class="o">:</span> <span class="s2">"IllegalArgumentException"</span><span class="p">,</span>
<span class="s2">"errorMessage"</span><span class="o">:</span> <span class="s2">"Invalid uuid format."</span>
<span class="p">}</span>
</pre></div>
</div>
<p>The <code class="docutils literal notranslate"><span class="pre">errorMessage</span></code> is not always matches Mojangs strings, but the differences are only apparent to Ely-specific errors. The original requests and the errors expected from them repeat Mojang texts.</p>
</div>
</div>
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="/en/authlib-injector.html" class="btn btn-neutral float-right" title="Authlib-injector" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
<a href="/en/index.html" class="btn btn-neutral float-left" title="Welcome to the Ely.by documentation!" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
</div>
<hr>
<div role="contentinfo">
<p>
© Copyright 2024, Ely.by.
</p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-45299905-2"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-45299905-2');
</script>
</body>
</html>