Commit 6b03e481 authored by PidgeyL's avatar PidgeyL
Browse files

status codes in documentation

parent 90aa1868
Loading
Loading
Loading
Loading
+24 −5
Original line number Diff line number Diff line
@@ -2,6 +2,9 @@
{% set api_admin_set = ['whitelist', 'blacklist', 'whitelist_export', 'blacklist_export', 'whitelist_import', 
                        'blacklist_import', 'whitelist_drop', 'blacklist_drop', 'whitelist_add', 'blacklist_add',
                        'whitelist_remove', 'blacklist_remove', 'dbupdate'] %}
{% set status_codes = ['success', 'authorization_method_not_allowed', 'malformed_authentication_string',
                       'authentication_needed', 'authentication_failed', 'not_found', 'unknown_content-type',
                       'internal_server_error', 'resource_unavailable'] %}
<html lang="en">
  <head>
    <!-- metadata -->
@@ -77,6 +80,7 @@
            <div id="sidebar_content">
              <a href="#auth">             <h4>Authentication  </h4></a>
              <a href="#headers">          <h4>Optional headers</h4></a>
              <a href="#http_status_codes"><h4>Status Codes    </h4></a>
              <a href="#queries">          <h4>API Queries     </h4></a>
              <ul id="API_Sidebar">
                {% for id in api_set %}
@@ -96,14 +100,17 @@
              <div class="panel-body">
                <h4>Authentication</h4>
                <p>
                  Some API calls require authentication. Authentication is done in one of two ways:
                  Some API calls require authentication. These are colored yellow in the API Query list.
                  Authentication is done in one of two ways:
                  <ul>
                    <li>basic &lt;username&gt;:&lt;password&gt; (Not recommended)</li>
                    <li>token &lt;username&gt;:&lt;token&gt; </li>
                    <li>session &lt;username&gt;:&lt;session id&gt; (Recommended)</li>
                  </ul>
                  Authentication is done by adding the following header to the HTTP request: <br />
                  <pre>Authorization: basic user:password123</pre> or 
                  <pre>Authorization: token user:679c2955085b46e48155b84f4c878844</pre> <br />
                  <pre>Authorization: token user:679c2955085b46e48155b84f4c878844</pre> or
                  <pre>Authorization: session user:ea234b864515411d9d834e2bd561af98</pre><br />
                  <b>PLEASE NOTE: Neither the password nor the token are obfuscated, so it is <u>strongly</u> advised to use HTTPS</b>
                </p>
              </div>
@@ -130,6 +137,18 @@
                and only plain text output will be used. As of version 1.1, the Accept header will be taken into account.
              </div>
            </div>
            
            <div id="http_status_codes" class="panel panel-default">
              <div class="panel-body">
                <h4>Status Codes</h4>
                <div class="panel-group" id="status_codes">
                  {% for doc in status_codes %}
                    {% include 'documentation/status_codes/'+doc%}
                  {% endfor %}
                </div>
              </div>
            </div>
            
            <div id="queries" class="panel panel-default">
              <div class="panel-body">
                <h4>API Queries</h4>
+7 −0
Original line number Diff line number Diff line
{% extends 'layouts/status_code_accordion-child' %}
{% set id     = "authentication_failed"          %}
{% set title  = "Authentication Failed"          %}
{% set code   = 401                              %}
{% block desc %}
  Authentication failed because the credentials provided were incorrect.
{% endblock %}
+7 −0
Original line number Diff line number Diff line
{% extends 'layouts/status_code_accordion-child' %}
{% set id     = "authentication_needed"          %}
{% set title  = "Authentication needed"          %}
{% set code   = 401                              %}
{% block desc %}
  This request required authentication.
{% endblock %}
+15 −0
Original line number Diff line number Diff line
{% extends 'layouts/status_code_accordion-child'   %}
{% set id     = "authorization_method_not_allowed" %}
{% set title  = "Authorization Method Not Allowed" %}
{% set code   = 400                                %}
{% block desc %}
  The specified authentication method (in the Authorization header) is not allowed. <br />
  Allowed authorization methods are:
  <ul>
    <li>basic   (user:password)    </li>
    <li>token   (user:token)       </li>
    <li>session (user:session_key) </li>
  </ul>
{% endblock %}

+8 −0
Original line number Diff line number Diff line
{% extends 'layouts/status_code_accordion-child' %}
{% set id     = "internal_server_error"          %}
{% set title  = "Internal Server Error"          %}
{% set code   = 500                              %}
{% block desc %}
  These errors get thrown when the server experienced an error it did not expect. <br />
  In case this happens, the server should print the error to the console.
{% endblock %}
Loading