117 lines
4.7 KiB
HTML
117 lines
4.7 KiB
HTML
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<link rel="stylesheet" href="/static/newposts.css">
|
|
<meta property="og:site_name" content="enstrayed.com">
|
|
<meta property="og:url" content="https://enstrayed.com/posts/20240409-API-Documentation.html">
|
|
|
|
<title>Enstrayed: API Documentation</title>
|
|
<meta property="og:title" content="Enstrayed: API Documentation">
|
|
|
|
<meta name="description" content="List of all endpoints and associated information for my web API">
|
|
<meta property="og:description" content="List of all endpoints and associated information for my web API">
|
|
|
|
</head>
|
|
<body>
|
|
<a href="/">Return to enstrayed.com</a>
|
|
<h1>API Documentation</h1>
|
|
<p>This page was last updated 2025-12-15.</p>
|
|
|
|
<hr>
|
|
<h2>Attention: This page is overdue for a rewrite and the information currently presented may not be accurate.</h2>
|
|
|
|
<div class="inlineheader">
|
|
<h2>/api/nowplaying</h2>
|
|
<a href="https://git.enstrayed.com/enstrayed/enstrayedapi/src/branch/main/routes/nowplaying.js">nowplaying.js</a>
|
|
<div>
|
|
<span>GET</span>
|
|
</div>
|
|
</div>
|
|
|
|
<p>Returns whatever I'm listening to via the Last.fm API in JSON. If <code>?format=html</code> is used in the URL it will return the same but in HTML. If nothing is playing the JSON response will just have <code>"playing": false</code>.</p>
|
|
|
|
<div class="inlineheader">
|
|
<h2>/api/nowplayingbeta</h2>
|
|
<a href="https://git.enstrayed.com/enstrayed/enstrayedapi/src/branch/main/routes/nowplaying.js">nowplaying.js</a>
|
|
<div>
|
|
<span>GET</span>
|
|
</div>
|
|
</div>
|
|
|
|
<p>Beta verison of the /nowplaying endpoint. This version will change frequently but presently queries my Jellyfin for what I'm listening to and will return that as JSON. If <code>?format=html</code> is appended to the URL it will return the same but in HTML. Each line in the HTML response has a class <code>nowPlayingLine[1-4]</code> that can be used to style the text using CSS. See <a href="https://github.com/Enstrayed/enstrayedapi/blob/main/liberals/libnowplaying.js#L63">libnowplaying.js:63</a> for the format of the result.</p>
|
|
|
|
<div class="inlineheader">
|
|
<h2>/api/etyd/*</h2>
|
|
<a href="https://git.enstrayed.com/enstrayed/enstrayedapi/src/branch/main/routes/etyd.js">etyd.js</a>
|
|
<div>
|
|
<span>GET</span>
|
|
<span>POST</span>
|
|
<span>DELETE</span>
|
|
</div>
|
|
</div>
|
|
|
|
<p>Retrieves, creates or deletes entries for the etyd.cc URL shortener. Replace * in the URL for the target of the request.</p>
|
|
|
|
<span>Required Headers (POST, DELETE):</span>
|
|
<ul>
|
|
<li><code>Authorization</code>: A token with the <code>etyd</code> scope</li>
|
|
</ul>
|
|
<span>Required Body (POST):</span>
|
|
<pre><code>{
|
|
"url": "urlValue"
|
|
}</code></pre>
|
|
|
|
<div class="inlineheader">
|
|
<h2>/api/sendemail</h2>
|
|
<a href="https://git.enstrayed.com/enstrayed/enstrayedapi/src/branch/main/routes/email.js">email.js</a>
|
|
<div>
|
|
<span>POST</span>
|
|
</div>
|
|
</div>
|
|
|
|
<p>Sends an email to the specified recipient, intended for application & automation use.</p>
|
|
|
|
<span>Required Headers:</span>
|
|
<ul>
|
|
<li><code>Authorization</code>: A token with the <code>mailjet</code> scope</li>
|
|
</ul>
|
|
<span>Required Body:</span>
|
|
<pre><code>{
|
|
"recipient": "recipientEmailHere",
|
|
"subject": "emailSubjectHere",
|
|
"message": "emailBodyHere"
|
|
}</code></pre>
|
|
|
|
<div class="inlineheader">
|
|
<h2>/ip</h2>
|
|
<a href="https://git.enstrayed.com/enstrayed/enstrayedapi/src/branch/main/routes/ip.js">ip.js</a>
|
|
<div><span>GET</span></div>
|
|
</div>
|
|
|
|
<p>Returns the IP, country and Cloudflare ray of the request in JSON.</p>
|
|
|
|
<div class="inlineheader">
|
|
<h2>/api/headers</h2>
|
|
<a href="https://git.enstrayed.com/enstrayed/enstrayedapi/src/branch/main/routes/ip.js">ip.js</a>
|
|
<div><span>GET</span></div>
|
|
</div>
|
|
|
|
<p>Returns all request headers in JSON.</p>
|
|
|
|
<div class="inlineheader">
|
|
<h2>/api/auth/whoami</h2>
|
|
<a href="https://git.enstrayed.com/enstrayed/enstrayedapi/src/branch/main/routes/auth.js">auth.js</a>
|
|
<div><span>GET</span></div>
|
|
</div>
|
|
<p>Returns JSON with the username of the token owner as well as what scopes the token has access to.</p>
|
|
|
|
<div class="inlineheader">
|
|
<h2>/api/auth/logout</h2>
|
|
<a href="https://git.enstrayed.com/enstrayed/enstrayedapi/src/branch/main/routes/auth.js">auth.js</a>
|
|
<div><span>GET</span></div>
|
|
</div>
|
|
<p>Invalidates the token used to access the endpoint.</p>
|
|
|
|
</body>
|
|
</html> |