mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-12-05 07:25:08 +00:00
Deployed f10b8dcf with MkDocs version: 1.6.1
This commit is contained in:
@@ -2397,58 +2397,7 @@
|
||||
<div class="language-shell highlight"><pre><span></span><code><span id="__span-4-1"><a id="__codelineno-4-1" name="__codelineno-4-1" href="#__codelineno-4-1"></a>unshackle<span class="w"> </span>serve<span class="w"> </span>--api-only
|
||||
</span></code></pre></div>
|
||||
<p>By default the server binds to <code>127.0.0.1:8786</code>. The <code>--api-only</code> flag serves only the REST API and omits the Widevine/PlayReady CDM HTTP endpoints. Drop it when you also want those endpoints.</p>
|
||||
<p>Common options:</p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Option</th>
|
||||
<th>Default</th>
|
||||
<th>Effect</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><code>-h, --host</code></td>
|
||||
<td><code>127.0.0.1</code></td>
|
||||
<td>Address to bind to</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>-p, --port</code></td>
|
||||
<td><code>8786</code></td>
|
||||
<td>Port to bind to</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>--api-only</code></td>
|
||||
<td>off</td>
|
||||
<td>Serve only the REST API, no CDM endpoints</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>--no-key</code></td>
|
||||
<td>off</td>
|
||||
<td>Disable API-key authentication (allow all requests)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>--debug-api</code></td>
|
||||
<td>off</td>
|
||||
<td>Include tracebacks and stderr in error responses</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>--debug</code></td>
|
||||
<td>off</td>
|
||||
<td>Enable DEBUG-level logging</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>--remote-only</code></td>
|
||||
<td>off</td>
|
||||
<td>Expose only the remote session routes: <code>/api/health</code>, <code>/api/services</code>, <code>/api/search</code>, <code>/api/session/*</code>, <code>/api/tunnel</code> and <code>/api/tunnel/check</code>, and the dashboard routes when <code>serve.dashboard.key</code> is set</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>--caddy</code></td>
|
||||
<td>off</td>
|
||||
<td>Also launch Caddy as a reverse proxy (for HTTPS)</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>The <a href="../../../guide/cli-reference/#serve"><code>serve</code> options</a> in the CLI reference give every flag.</p>
|
||||
<p>Once it is up you will see the API mounted under <code>/api/</code> and, unless you started in remote-only mode, an interactive Swagger UI:</p>
|
||||
<div class="language-text highlight"><pre><span></span><code><span id="__span-5-1"><a id="__codelineno-5-1" name="__codelineno-5-1" href="#__codelineno-5-1"></a>REST API endpoints available at http://127.0.0.1:8786/api/
|
||||
</span><span id="__span-5-2"><a id="__codelineno-5-2" name="__codelineno-5-2" href="#__codelineno-5-2"></a>Swagger UI available at http://127.0.0.1:8786/api/docs/
|
||||
@@ -2508,7 +2457,7 @@
|
||||
</span></code></pre></div>
|
||||
<div class="admonition warning">
|
||||
<p class="admonition-title">Two error shapes exist</p>
|
||||
<p>The authentication middleware returns the short <code>{"status": 401, "message": "..."}</code> shape shown above. Every <strong>other</strong> error the API produces uses the richer structured shape (<code>error_code</code>, <code>timestamp</code>, <code>details</code>, ...) described in <a href="#error-handling">Error handling</a>. Parse both shapes in your client.</p>
|
||||
<p>The authentication middleware answers with the short shape above, and every other JSON error has the <a href="../errors/#the-standard-error-shape">standard error shape</a>. Parse both shapes in your client.</p>
|
||||
</div>
|
||||
<p>The <code>tag</code> value for the service you want is the identifier you pass as <code>service</code> in the calls below.</p>
|
||||
<hr />
|
||||
@@ -2716,93 +2665,10 @@
|
||||
<p>The interactive <strong>Swagger UI at <code>/api/docs/</code></strong> documents every route and lets you try them in the browser (send your <code>X-Secret-Key</code> there too).</p>
|
||||
<hr />
|
||||
<h2 id="error-handling">Error handling<a class="headerlink" href="#error-handling" title="Permanent link">¶</a></h2>
|
||||
<p>Apart from the auth middleware's short form, every error the API returns uses a single structured envelope:</p>
|
||||
<div class="language-json highlight"><pre><span></span><code><span id="__span-27-1"><a id="__codelineno-27-1" name="__codelineno-27-1" href="#__codelineno-27-1"></a><span class="p">{</span>
|
||||
</span><span id="__span-27-2"><a id="__codelineno-27-2" name="__codelineno-27-2" href="#__codelineno-27-2"></a><span class="w"> </span><span class="nt">"status"</span><span class="p">:</span><span class="w"> </span><span class="s2">"error"</span><span class="p">,</span>
|
||||
</span><span id="__span-27-3"><a id="__codelineno-27-3" name="__codelineno-27-3" href="#__codelineno-27-3"></a><span class="w"> </span><span class="nt">"error_code"</span><span class="p">:</span><span class="w"> </span><span class="s2">"INVALID_PARAMETERS"</span><span class="p">,</span>
|
||||
</span><span id="__span-27-4"><a id="__codelineno-27-4" name="__codelineno-27-4" href="#__codelineno-27-4"></a><span class="w"> </span><span class="nt">"message"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Human-readable description"</span><span class="p">,</span>
|
||||
</span><span id="__span-27-5"><a id="__codelineno-27-5" name="__codelineno-27-5" href="#__codelineno-27-5"></a><span class="w"> </span><span class="nt">"timestamp"</span><span class="p">:</span><span class="w"> </span><span class="s2">"2026-07-03T12:00:00Z"</span><span class="p">,</span>
|
||||
</span><span id="__span-27-6"><a id="__codelineno-27-6" name="__codelineno-27-6" href="#__codelineno-27-6"></a><span class="w"> </span><span class="nt">"details"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="p">}</span>
|
||||
</span><span id="__span-27-7"><a id="__codelineno-27-7" name="__codelineno-27-7" href="#__codelineno-27-7"></a><span class="p">}</span>
|
||||
</span></code></pre></div>
|
||||
<p><code>details</code> appears only when the server has more to add. <code>retryable: true</code> appears only for transient failures. The server includes a <code>debug_info</code> block (exception type and traceback) only when it runs with <code>--debug-api</code>.</p>
|
||||
<p>The <code>error_code</code> maps to an HTTP status. The ones you will meet most often:</p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Error code</th>
|
||||
<th>HTTP</th>
|
||||
<th>Typical cause</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><code>INVALID_INPUT</code></td>
|
||||
<td>400</td>
|
||||
<td>Malformed JSON body or missing required field</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>INVALID_SERVICE</code></td>
|
||||
<td>400</td>
|
||||
<td>Unknown or disallowed service tag</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>INVALID_PARAMETERS</code></td>
|
||||
<td>400</td>
|
||||
<td>A download field failed validation</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>AUTH_FAILED</code></td>
|
||||
<td>401</td>
|
||||
<td>Service login/credential failure</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>FORBIDDEN</code></td>
|
||||
<td>403</td>
|
||||
<td>A gated field was used without server opt-in</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>NOT_FOUND</code></td>
|
||||
<td>404</td>
|
||||
<td>Title or resource does not exist</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>JOB_NOT_FOUND</code></td>
|
||||
<td>404</td>
|
||||
<td>No job with that <code>job_id</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>CONFLICT</code></td>
|
||||
<td>409</td>
|
||||
<td>Illegal state transition (e.g. retry a running job)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>SERVICE_ERROR</code></td>
|
||||
<td>422</td>
|
||||
<td>The service raised an error</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>RATE_LIMITED</code></td>
|
||||
<td>429</td>
|
||||
<td>Upstream throttling (retryable)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>INTERNAL_ERROR</code></td>
|
||||
<td>422</td>
|
||||
<td>Unexpected server-side failure</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>NETWORK_ERROR</code></td>
|
||||
<td>424</td>
|
||||
<td>Connection/timeout reaching the service (retryable)</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>The <a href="../errors/#error-code-catalogue">error code catalogue</a> lists every code.</p>
|
||||
<div class="admonition tip">
|
||||
<p class="admonition-title">Retry politely</p>
|
||||
<p>Codes marked retryable (<code>NETWORK_ERROR</code>, <code>RATE_LIMITED</code>, <code>SERVICE_UNAVAILABLE</code>) reflect transient conditions. Back off and retry rather than hammering the server.</p>
|
||||
</div>
|
||||
<p>Every JSON error has one of two shapes: the <a href="../errors/#the-standard-error-shape">standard error shape</a>,
|
||||
or the <a href="../errors/#the-authentication-error-exception">authentication error</a> of the API-key
|
||||
middleware. The <a href="../errors/#error-code-catalogue">error code catalogue</a> gives the HTTP status of
|
||||
each code, and <a href="../errors/#the-retryable-hint">the <code>retryable</code> hint</a> marks the errors to retry.</p>
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user