Changed /api to /docs for frontend

This commit is contained in:
nise.moe 2024-06-10 16:52:33 +02:00
parent 1907c22b16
commit 31cbaa120e
3 changed files with 139 additions and 100 deletions

View File

@ -0,0 +1,4 @@
section {
padding-bottom: 30px;
border-bottom: 2px dotted rgba(224, 224, 224, 0.32);
}

View File

@ -14,10 +14,14 @@
<li>The <code>X-NISE-API</code> header with a value of <code>20240218</code> in every request. This should prevent random shit from breaking in the future (if you keep passing it)</li>
<li>The <code>Accept</code> header with a value of <code>application/json</code> (if you want JSON instead of XML)</li>
</ul>
<section>
<h1 class="mt-4">## scores search</h1>
<p>score search is based on predicates. a predicate is a list of specifications/conditions to match results. predicates can be combined with operators such as <code>AND</code> and <code>OR</code></p>
<p style="font-weight: bold; color: orange">COMING SOON; the route exists but its cancer for api users to form the requests.</p>
</section>
<section>
<h1 class="mt-4">## get single score</h1>
<p>if you have a <code>replay_id</code>, you can retrieve all the information 'bout that score.</p>
<ul>
@ -29,7 +33,9 @@
<app-code-with-copy-button>
curl -H "X-NISE-API: 20240218" -H "Accept: application/json" https://nise.moe/api/score/3808640439
</app-code-with-copy-button>
</section>
<section>
<h1 class="mt-4">## get single replay (data)</h1>
<p>if you have a <code>replay_id</code>, you can retrieve the data that is used for the replay viewer <i>(replay.nise.moe)</i>
<p>it contains the beatmap data, the full replay data, and all calculated judgements (by circleguard)</p>
@ -42,19 +48,23 @@
<app-code-with-copy-button>
curl -H "X-NISE-API: 20240218" -H "Accept: application/json" https://nise.moe/api/score/3808640439/replay
</app-code-with-copy-button>
</section>
<section>
<h1 class="mt-4">## get single replay (.osr)</h1>
<p>if you have a <code>replay_id</code>, you can retrieve the <i>emulated</i> .osr replay file.</p>
<p><i>wtf is an emulated .osr replay file?</i> 🡒 the osu!api does NOT return a "real" replay, so we fill the rest of the details.</p>
<p style="font-weight: bold; color: orange">COMING SOON</p>
</section>
<section>
<h1 class="mt-4">## get user details</h1>
<p>if you have an <code>user_id</code>, you can retrieve everything we know 'bout that user.
<p style="font-weight: bold; color: #fa5c5c">>> <strong>user_id</strong> is the username. sry.</p>
<p>if you have an <code>userId</code>, you can retrieve everything we know 'bout that user.
<p style="font-weight: bold; color: #fa5c5c">>> <strong>userId</strong> is the username. sry.</p>
<ul>
<li><strong>ENDPOINT:</strong> <code>/api/user-details</code></li>
<li><strong>METHOD:</strong> POST</li>
<li><strong>POST FIELDS:</strong> user_id: str (*required)</li>
<li><strong>POST FIELDS:</strong> userId: str (*required. case insensitive)</li>
<li><strong>POST FORMAT:</strong> JSON only</li>
</ul>
Example:
@ -62,7 +72,27 @@
<app-code-with-copy-button>
curl -X POST -H "X-NISE-API: 20240218" -H "Accept: application/json" -H "Content-Type: application/json" -d '&#123;"userId": "degenerate"&#125;' https://nise.moe/api/user-details
</app-code-with-copy-button>
</section>
<section>
<h1 class="mt-4">## request user score update</h1>
<p>if you have an <code>userId</code>, you can queue a request to update all scores for that user.</p>
<p style="font-weight: bold; color: #ffd47c">>> <span style="font-weight: bold; font-size: 24px">!</span> we rate limit this at a single update every 4 hours for each individual user.</p>
<p style="font-weight: bold; color: #ffa289">>> this endpoint is AUTHED, you need to send your <code>SESSION</code> cookie for now. ill work on API keys or smth.</p>
<ul>
<li><strong>ENDPOINT:</strong> <code>/api/user-queue</code></li>
<li><strong>METHOD:</strong> POST</li>
<li><strong>POST FIELDS:</strong> userId: long (*required)</li>
<li><strong>POST FORMAT:</strong> JSON only</li>
</ul>
Example:
<br>
<app-code-with-copy-button>
curl -X POST -H "X-NISE-API: 20240218" -H "Accept: application/json" -H "Content-Type: application/json" --cookie "SESSION=xxx" -d '&#123;"userId": 8184689&#125;' https://nise.moe/api/user-queue
</app-code-with-copy-button>
</section>
<section>
<h1 class="mt-4">## get suspicious scores</h1>
<p>returns a list of suspicious scores (e.g. cvUR <= 25, basically <span style="font-size: 18px" class="board">/sus/</span>)</p>
<p>it is not <i>live</i>, but rather updates every N minutes depending on server load (usually ~10 minutes)</p>
@ -75,7 +105,9 @@
<app-code-with-copy-button>
curl -H "X-NISE-API: 20240218" -H "Accept: application/json" https://nise.moe/api/suspicious-scores
</app-code-with-copy-button>
</section>
<section>
<h1 class="mt-4">## get stolen replays</h1>
<p>returns a list of all replay pairs with < 10 similarity ratio (basically <span style="font-size: 18px" class="board">/nu/</span>)</p>
<p>it is not <i>live</i>, but rather updates every N minutes depending on server load (usually ~10 minutes)</p>
@ -88,7 +120,9 @@
<app-code-with-copy-button>
curl -H "X-NISE-API: 20240218" -H "Accept: application/json" https://nise.moe/api/similar-replays
</app-code-with-copy-button>
</section>
<section>
<h1 class="mt-4">## get banlist</h1>
<p>returns a list of all <i>possibly<strong>*</strong></i> banned users<br><strong>*</strong>(so users for which the osu!web page returned the <code>User not found! ;_;</code> response.)</p>
<p style="font-weight: bold; color: #ff6dff">>> page size aint configurable, it's 100 atm. maybe a TODO.</p>
@ -103,7 +137,9 @@
<app-code-with-copy-button>
curl -X POST -H "X-NISE-API: 20240218" -H "Accept: application/json" -H "Content-Type: application/json" -d '&#123;"page": 1&#125;' https://nise.moe/api/banlist
</app-code-with-copy-button>
</section>
<section>
<h1 class="mt-4">## analyze replay file (.osr)</h1>
<p>if you have an .osr file, you can analyze it and get results + an always-online static page for it.</p>
<ul>
@ -120,8 +156,7 @@
<li><strong>WEB INTERFACE</strong>: https://nise.moe/c/&#123;id&#125;</li>
<li><strong>API:</strong> https://nise.moe/api/user-scores/&#123;id&#125;</li>
</ul>
<hr>
</section>
<div class="mb-2 text-center">
<p>

View File

@ -30,7 +30,7 @@ const routes: Routes = [
{path: 'banlist', component: BanlistComponent, title: '/ban/'},
{path: 'contribute', component: ContributeComponent, title: '/contribute/ <3'},
{path: 'api', component: ApiComponent, title: '/api/ explanation'},
{path: 'docs', component: ApiComponent, title: '/api/ explanation'},
{path: '**', component: HomeComponent, title: '/nise.moe/'},
];