{% set api_set = ['cpe22', 'cpe23', 'cvefor', 'cve', 'cwe', 'capec', 'last', 'query', 'browse', 'search', 'link', 'dbInfo'] %}
{% 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', 'skip_must_be_int', 'limit_must_be_int', '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 -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <meta name="description" content="Common Vulnerability Exposure most recent entries"/>
    <meta name="author" content="http://github.com/cve-search/cve-search - cve-search"/>

    <!-- css -->
    <link href="/static/css/bootstrap.min.css" rel="stylesheet" />
    <link href="/static/css/style.css"         rel="stylesheet" />
    <link href="/static/css/sidebar.css"       rel="stylesheet" />

    <!-- favicon -->
    <link rel="shortcut icon" href="/static/img/favicon.ico" />

    <!-- javascript -->
    <!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
      <script src="/static/js/html5shiv.js"></script>
    <![endif]-->
    <script type="text/javascript" src="/static/js/jquery-1.11.2.min.js"></script>
    <script type="text/javascript" src="/static/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="/static/js/custom/scripts.js"></script>
    
    <title>API Documentation - CVE-Search</title>
    <style>
      body{
        background-color: DFDFDF;
      }
      #sidebar{
        background-color: gray;
        float: left;
        width: 205px;
        position: fixed;
        overflow: hidden;
        height: 100%;
      }
      #sidebar_content{
        width: 220px;
        overflow-y: scroll;
        height: 100%;
      }
      nav {
        padding: 20px 15px;
      }
      nav ul {
        padding-left: 5px;
      }
      nav ul li {
        margin: 0;
        padding: 0;
        list-style-type: none;
      }
      nav a {
        color: white;
      }
      nav a:hover{
        color: #DDD;
      }
      #content{
        margin-left: 210px;
      }
    </style>
  </head>
  <body>
    <div class="container-fluid">
      <div class="row">
        <div class="col-sm-12">
          <!-- Body Start -->
          <!-- Sidebar Nav -->
          <nav id="sidebar">
            <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 %}
                  <li><a data-toggle="collapse" data-parent="#api_links" href="#{{ id }}">/api/{{ id }}</a></li>
                {% endfor %}
                {% if advanced %}
                  {% for id in api_admin_set %}
                    <li><a data-toggle="collapse" data-parent="#api_links" href="#{{ id }}">/api/admin/{{ id|replace('_', '/') }}</a></li>
                  {% endfor %}
                {% endif %}
              </ul>
            </div>
          </nav>
          <!-- Documentation -->
          <div id="content">
            <div id="auth" class="panel panel-default">
              <div class="panel-body">
                <h4>Authentication</h4>
                <p>
                  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> 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>
            </div>
            <div id="headers" class="panel panel-default">
              <div class="panel-body">
                <h4>Optional Headers</h4>
                The following headers can be appended to any request:
                <ul>
                  <li>Accept</li>
                  <li>Version</li>
                </ul>
                <h5><b>Accept</b></h5>
                The Accept argument may contain one of two categories:
                <ul>
                  <li>*/json (*/* will default to text/json)</li>
                  <li>*/plain</li>
                </ul>
                All the examples you see in this documentation are the output of the */plain choice. <br/>
                The */json choice will incapsulate all output with a status code, of the format:
                <pre>{'status': 'success', 'data': &lt;output of */plain&gt;}</pre>
                <h5><b>Version</b></h5>
                The version of the API call. For backwards compatibility, when the version is not specified, version 1.0 (legacy) will be used
                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>
                <div class="panel-group" id="api_links">
                  {% for doc in api_set %}
                    {% include 'documentation/api/'+doc%}
                  {% endfor %}
                  {% if advanced %}
                    {% for doc in api_admin_set %}
                      {% include 'documentation/api/'+doc%}
                    {% endfor %}
                  {% endif %}
                </div>
              </div>
            </div>
          </div>
          <a href="#" class="back-to-top">Back to Top</a>
          <!-- Body End -->
        </div>
      </div>
    </div>
  </body>
</html>
