aboutsummaryrefslogtreecommitdiffstats
path: root/www/docs.html
diff options
context:
space:
mode:
authorjustanothercatgirl <sotov@twistea.su>2025-03-31 15:44:36 +0300
committerjustanothercatgirl <sotov@twistea.su>2025-03-31 15:44:36 +0300
commit08403b616f9dad83cb1204eec83ba1252e3eb129 (patch)
tree7d248c9db76d1b1bf9f303b9c0caadf1dd765a8d /www/docs.html
parent82742d5d13dc7b0691a79c79f8e62782fcb16e10 (diff)
Early working state.
TODO: * /api/linkdel, /api/linkget * finish website
Diffstat (limited to 'www/docs.html')
-rw-r--r--www/docs.html12
1 files changed, 8 insertions, 4 deletions
diff --git a/www/docs.html b/www/docs.html
index a2fa287..8e892df 100644
--- a/www/docs.html
+++ b/www/docs.html
@@ -20,7 +20,7 @@
<h3>API reference</h3>
<p>The API follows this convention: everything is done through GET requests, client supplies all necessary parameters in URLencoded format.
Whatever server returns depends on parameters; it may be application/json (for programmable API) OR text/html (to render in HTML)</p>
- <p>Example request: <span>http://ln.twistea.su/api/linkadd?url=https%3A%2F%2Fexample.com&amp;format=html</span>.<br>
+ <p>Example request: <span>http://ln.twistea.su/api/linkadd?url=https%3A%2F%2Fexample.com&amp;format=html</span>.<br/>
This request may return something like: <span>&lt;a href="http://server.com/DEADF00D"&gt;your link: DEADF00D&lt;/a&gt;</span></p>
<p>Note: server may return json string like <span>null</span> or <span>true</span>: according to
<a href="https://www.rfc-editor.org/rfc/rfc8259#section-13">rfc-8259</a>, this is valid json and clients have to handle this accordingly.</p>
@@ -30,8 +30,9 @@
<li><span>invalid arguments</span>: argument's type/value does not match with what server expects.</li>
<li><span>occupied</span>: the path at which the link was attempted to be created is occupied already.</li>
<li><span>server error</span>: something went wrong on the server. Will include additional json field "what" with error message.</li>
+ <li><span>path too long</span>: the path is too long.</li>
<li><span>unknown</span>: server does not know what the hell went wrong</li>
- </ul>Plese note that the HTTP return status for malformed request may be BAD_REQUEST (400) or INTERNAL_SERVER_ERROR (500)</p>
+ </ul>Plese note that the HTTP return status for malformed request may be BAD_REQUEST (400), URI_TOO_LONG (414), NOT_FOUND (404) or INTERNAL_SERVER_ERROR (500)</p>
<table>
<thead>
<caption>Table 1. Global parameters (applicable to all endpoints)</caption>
@@ -82,7 +83,10 @@
</tr>
<tr>
<td>try?</td>
- <td class="uns">string: <span>PATH</span> to try to put link under <br>
+ <td class="uns">string: <span>PATH</span> to try to put link under <br/>
+ shoud match regex <span>[a-zA-Z0-9]+</span>, length &leq; 10 <br/>
+ may work with length = 11, but not always
+ <br/>
(if not occupied, WITHOUT <span>https://server.com/</span>)</td>
</tr>
<tr>
@@ -95,7 +99,7 @@
<td>/api/linkget</td>
<td>path</td>
<td>string: PATH to get link info from</td>
- <td>{"url": "original url", created: int unix_timestamp}<br>
+ <td>{"url": "original url", created: int unix_timestamp}<br/>
OR null
</td>
</tr>