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,114 +14,149 @@
<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>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> <li>The <code>Accept</code> header with a value of <code>application/json</code> (if you want JSON instead of XML)</li>
</ul> </ul>
<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>
<h1 class="mt-4">## get single score</h1> <section>
<p>if you have a <code>replay_id</code>, you can retrieve all the information 'bout that score.</p> <h1 class="mt-4">## scores search</h1>
<ul> <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>
<li><strong>ENDPOINT:</strong> <code>/api/score/&#123;replay_id&#125;</code></li> <p style="font-weight: bold; color: orange">COMING SOON; the route exists but its cancer for api users to form the requests.</p>
<li><strong>METHOD:</strong> GET</li> </section>
</ul>
Example:
<br>
<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>
<h1 class="mt-4">## get single replay (data)</h1> <section>
<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> <h1 class="mt-4">## get single score</h1>
<p>it contains the beatmap data, the full replay data, and all calculated judgements (by circleguard)</p> <p>if you have a <code>replay_id</code>, you can retrieve all the information 'bout that score.</p>
<ul> <ul>
<li><strong>ENDPOINT:</strong> <code>/api/score/&#123;replay_id&#125;/replay</code></li> <li><strong>ENDPOINT:</strong> <code>/api/score/&#123;replay_id&#125;</code></li>
<li><strong>METHOD:</strong> GET</li> <li><strong>METHOD:</strong> GET</li>
</ul> </ul>
Example: Example:
<br> <br>
<app-code-with-copy-button> <app-code-with-copy-button>
curl -H "X-NISE-API: 20240218" -H "Accept: application/json" https://nise.moe/api/score/3808640439/replay curl -H "X-NISE-API: 20240218" -H "Accept: application/json" https://nise.moe/api/score/3808640439
</app-code-with-copy-button> </app-code-with-copy-button>
</section>
<h1 class="mt-4">## get single replay (.osr)</h1> <section>
<p>if you have a <code>replay_id</code>, you can retrieve the <i>emulated</i> .osr replay file.</p> <h1 class="mt-4">## get single replay (data)</h1>
<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>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 style="font-weight: bold; color: orange">COMING SOON</p> <p>it contains the beatmap data, the full replay data, and all calculated judgements (by circleguard)</p>
<ul>
<li><strong>ENDPOINT:</strong> <code>/api/score/&#123;replay_id&#125;/replay</code></li>
<li><strong>METHOD:</strong> GET</li>
</ul>
Example:
<br>
<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>
<h1 class="mt-4">## get user details</h1> <section>
<p>if you have an <code>user_id</code>, you can retrieve everything we know 'bout that user. <h1 class="mt-4">## get single replay (.osr)</h1>
<p style="font-weight: bold; color: #fa5c5c">>> <strong>user_id</strong> is the username. sry.</p> <p>if you have a <code>replay_id</code>, you can retrieve the <i>emulated</i> .osr replay file.</p>
<ul> <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>
<li><strong>ENDPOINT:</strong> <code>/api/user-details</code></li> <p style="font-weight: bold; color: orange">COMING SOON</p>
<li><strong>METHOD:</strong> POST</li> </section>
<li><strong>POST FIELDS:</strong> user_id: str (*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" -d '&#123;"userId": "degenerate"&#125;' https://nise.moe/api/user-details
</app-code-with-copy-button>
<h1 class="mt-4">## get suspicious scores</h1> <section>
<p>returns a list of suspicious scores (e.g. cvUR <= 25, basically <span style="font-size: 18px" class="board">/sus/</span>)</p> <h1 class="mt-4">## get user details</h1>
<p>it is not <i>live</i>, but rather updates every N minutes depending on server load (usually ~10 minutes)</p> <p>if you have an <code>userId</code>, you can retrieve everything we know 'bout that user.
<ul> <p style="font-weight: bold; color: #fa5c5c">>> <strong>userId</strong> is the username. sry.</p>
<li><strong>ENDPOINT:</strong> <code>/api/suspicious-scores</code></li> <ul>
<li><strong>METHOD:</strong> GET</li> <li><strong>ENDPOINT:</strong> <code>/api/user-details</code></li>
</ul> <li><strong>METHOD:</strong> POST</li>
Example: <li><strong>POST FIELDS:</strong> userId: str (*required. case insensitive)</li>
<br> <li><strong>POST FORMAT:</strong> JSON only</li>
<app-code-with-copy-button> </ul>
curl -H "X-NISE-API: 20240218" -H "Accept: application/json" https://nise.moe/api/suspicious-scores Example:
</app-code-with-copy-button> <br>
<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>
<h1 class="mt-4">## get stolen replays</h1> <section>
<p>returns a list of all replay pairs with < 10 similarity ratio (basically <span style="font-size: 18px" class="board">/nu/</span>)</p> <h1 class="mt-4">## request user score update</h1>
<p>it is not <i>live</i>, but rather updates every N minutes depending on server load (usually ~10 minutes)</p> <p>if you have an <code>userId</code>, you can queue a request to update all scores for that user.</p>
<ul> <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>
<li><strong>ENDPOINT:</strong> <code>/api/similar-replays</code></li> <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>
<li><strong>METHOD:</strong> GET</li> <ul>
</ul> <li><strong>ENDPOINT:</strong> <code>/api/user-queue</code></li>
Example: <li><strong>METHOD:</strong> POST</li>
<br> <li><strong>POST FIELDS:</strong> userId: long (*required)</li>
<app-code-with-copy-button> <li><strong>POST FORMAT:</strong> JSON only</li>
curl -H "X-NISE-API: 20240218" -H "Accept: application/json" https://nise.moe/api/similar-replays </ul>
</app-code-with-copy-button> 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>
<h1 class="mt-4">## get banlist</h1> <section>
<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> <h1 class="mt-4">## get suspicious scores</h1>
<p style="font-weight: bold; color: #ff6dff">>> page size aint configurable, it's 100 atm. maybe a TODO.</p> <p>returns a list of suspicious scores (e.g. cvUR <= 25, basically <span style="font-size: 18px" class="board">/sus/</span>)</p>
<ul> <p>it is not <i>live</i>, but rather updates every N minutes depending on server load (usually ~10 minutes)</p>
<li><strong>ENDPOINT:</strong> <code>/api/banlist</code></li> <ul>
<li><strong>METHOD:</strong> POST</li> <li><strong>ENDPOINT:</strong> <code>/api/suspicious-scores</code></li>
<li><strong>POST FIELDS:</strong> page: int (*required, starts at 1)</li> <li><strong>METHOD:</strong> GET</li>
<li><strong>POST FORMAT:</strong> JSON only</li> </ul>
</ul> Example:
Example: <br>
<br> <app-code-with-copy-button>
<app-code-with-copy-button> curl -H "X-NISE-API: 20240218" -H "Accept: application/json" https://nise.moe/api/suspicious-scores
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>
</app-code-with-copy-button> </section>
<h1 class="mt-4">## analyze replay file (.osr)</h1> <section>
<p>if you have an .osr file, you can analyze it and get results + an always-online static page for it.</p> <h1 class="mt-4">## get stolen replays</h1>
<ul> <p>returns a list of all replay pairs with < 10 similarity ratio (basically <span style="font-size: 18px" class="board">/nu/</span>)</p>
<li><strong>ENDPOINT:</strong> <code>/api/analyze</code></li> <p>it is not <i>live</i>, but rather updates every N minutes depending on server load (usually ~10 minutes)</p>
<li><strong>METHOD:</strong> POST</li> <ul>
<li><strong>POST FIELDS:</strong> replay: file (*required, an .osr file)</li> <li><strong>ENDPOINT:</strong> <code>/api/similar-replays</code></li>
</ul> <li><strong>METHOD:</strong> GET</li>
<app-code-with-copy-button> </ul>
curl -X POST -H "X-NISE-API: 20240218" -H "Accept: application/json" -F "replay=&#64;replay1.osr" https://nise.moe/api/analyze Example:
</app-code-with-copy-button> <br>
<p>the response will include an <code>id</code> parameter, which identifies the replay you've uploaded.</p> <app-code-with-copy-button>
<p>that id will be subsequently available at:</p> curl -H "X-NISE-API: 20240218" -H "Accept: application/json" https://nise.moe/api/similar-replays
<ul> </app-code-with-copy-button>
<li><strong>WEB INTERFACE</strong>: https://nise.moe/c/&#123;id&#125;</li> </section>
<li><strong>API:</strong> https://nise.moe/api/user-scores/&#123;id&#125;</li>
</ul>
<hr> <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>
<ul>
<li><strong>ENDPOINT:</strong> <code>/api/banlist</code></li>
<li><strong>METHOD:</strong> POST</li>
<li><strong>POST FIELDS:</strong> page: int (*required, starts at 1)</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" -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>
<li><strong>ENDPOINT:</strong> <code>/api/analyze</code></li>
<li><strong>METHOD:</strong> POST</li>
<li><strong>POST FIELDS:</strong> replay: file (*required, an .osr file)</li>
</ul>
<app-code-with-copy-button>
curl -X POST -H "X-NISE-API: 20240218" -H "Accept: application/json" -F "replay=&#64;replay1.osr" https://nise.moe/api/analyze
</app-code-with-copy-button>
<p>the response will include an <code>id</code> parameter, which identifies the replay you've uploaded.</p>
<p>that id will be subsequently available at:</p>
<ul>
<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>
</section>
<div class="mb-2 text-center"> <div class="mb-2 text-center">
<p> <p>

View File

@ -30,7 +30,7 @@ const routes: Routes = [
{path: 'banlist', component: BanlistComponent, title: '/ban/'}, {path: 'banlist', component: BanlistComponent, title: '/ban/'},
{path: 'contribute', component: ContributeComponent, title: '/contribute/ <3'}, {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/'}, {path: '**', component: HomeComponent, title: '/nise.moe/'},
]; ];