<commit_before>{#
  Copyright (C) 2013  <NAME> <<EMAIL>>
  License: GNU Affero General Public License, version 3 or above.
#}

{% extends "base.html" %}

{% block head %}
{{ super() }}
<style>
  .url{display: block; /*margin-left: 50px;*/}
</style>
{% endblock %}

{% block title %}API documentation{% endblock %}

{% block breadcrumbs %}<a href="{{ url_for('doc') }}">doc</a> / api{% endblock %}

{% block content %}
{% set url_prefix = "http://" + config.DOMAIN %}

<h2>{{ self.title() }}</h2>

<p>You can query anything in the Debian sources, and get a JSON object
  which allows you to navigate into packages and source files.</p>

<p>The JSON result will be pretty-printed, unless the X-Requested-With header is set to XmlHttpRequest.</p>

<h3>Search</h3>

<h4>Package search</h4>
<p>
  By accessing the following URL:
  <span class="url">{{ url_prefix }}/api/search/<strong>query</strong></span>
  <a href="{{ url_prefix }}/api/search/hello">See example</a>
</p>

<h4>File search</h4>
<p>
  You can look for duplicate files using their SHA-256 sum:
  <span class="url">{{ url_prefix }}/api/sha256/?checksum=<strong>sha256</strong>&package=<strong>packagename</strong></span>
  Specifying a package name is optional.

<h4>Code search</h4>
<p>
  You can search within the code
  through <a href="http://ctags.sourceforge.net">tags</a>.
  <span class="url">{{ url_prefix
  }}/api/ctag/?ctag=<strong>tag</strong>&package=<strong>packagename</strong></span>
  Specifying a package name is optional.
</p>


<h3>Package list</h3>

<h4>All packages</h4>

<p>
  <span class="url">{{ url_prefix }}/api/list</span>
</p>

<h4>By prefix</h4>

<p>
  <span class="url">{{ url_prefix
    }}/api/prefix/<strong>prefix</strong></span>
  <a href="{{ url_prefix }}/api/prefix/libz">See example</a>
</p>

<h3>Package information</h3>

<p>
  List different versions of a package:
  <span class="url">{{ url_prefix
    }}/api/src/<strong>packagename</strong></span>
  <a href="{{ url_prefix }}/api/src/ocaml">See example</a>
</p>

<p>
  You can use
  <span class="url">{{ url_prefix
    }}/api/src/<strong>packagename</strong>/latest</span>
  to use automatically the latest available version of the package.
</p>

<p>
  Package information, including metrics, suites where is present, PTS link, and the like:
  <span class="url">{{ url_prefix
    }}/api/info/package/<strong>packagename</strong>/<strong>version</strong></span>
  <a href="{{ url_prefix }}/api/info/package/davfs2/1.5.2-1/">See example</a>
</p>

<h3>Navigation in source folders and files</h3>

<p>
  List folders and files in a folder:
  <span class="url">{{ url_prefix
    }}/api/src/<strong>packagename</strong>/<strong>version</strong>/<strong>path/to/folder</strong></span>
<a href="{{ url_prefix }}/api/src/cowsay/3.03%2Bdfsg1-4/cows">See example</a>
</p>

<p>
  Get information about a file (including the raw_url of the file, which<commit_msg>API documentation: refactor mention of the /latest redirection<commit_after>{#
  Copyright (C) 2013  <NAME> <<EMAIL>>
  License: GNU Affero General Public License, version 3 or above.
#}

{% extends "base.html" %}

{% block head %}
{{ super() }}
<style>
  .url{display: block; /*margin-left: 50px;*/}
</style>
{% endblock %}

{% block title %}API documentation{% endblock %}

{% block breadcrumbs %}<a href="{{ url_for('doc') }}">doc</a> / api{% endblock %}

{% block content %}
{% set url_prefix = "http://" + config.DOMAIN %}

<h2>{{ self.title() }}</h2>

<p>You can query anything in the Debian sources, and get a JSON object
  which allows you to navigate into packages and source files.</p>

<p>The JSON result will be pretty-printed, unless the X-Requested-With header is set to XmlHttpRequest.</p>

<p>Note: wherever a specific <em>version number</em> is required, you can use
  the string "latest" instead to get redirected to the most recent version of
  the package.</p>

<h3>Search</h3>

<h4>Package search</h4>
<p>
  By accessing the following URL:
  <span class="url">{{ url_prefix }}/api/search/<strong>query</strong></span>
  <a href="{{ url_prefix }}/api/search/hello">See example</a>
</p>

<h4>File search</h4>
<p>
  You can look for duplicate files using their SHA-256 sum:
  <span class="url">{{ url_prefix }}/api/sha256/?checksum=<strong>sha256</strong>&package=<strong>packagename</strong></span>
  Specifying a package name is optional.

<h4>Code search</h4>
<p>
  You can search within the code
  through <a href="http://ctags.sourceforge.net">tags</a>.
  <span class="url">{{ url_prefix
  }}/api/ctag/?ctag=<strong>tag</strong>&package=<strong>packagename</strong></span>
  Specifying a package name is optional.
</p>


<h3>Package list</h3>

<h4>All packages</h4>

<p>
  <span class="url">{{ url_prefix }}/api/list</span>
</p>

<h4>By prefix</h4>

<p>
  <span class="url">{{ url_prefix
    }}/api/prefix/<strong>prefix</strong></span>
  <a href="{{ url_prefix }}/api/prefix/libz">See example</a>
</p>

<h3>Package information</h3>

<p>
  List different versions of a package:
  <span class="url">{{ url_prefix
    }}/api/src/<strong>packagename</strong></span>
  <a href="{{ url_prefix }}/api/src/ocaml">See example</a>
</p>

<p>
  Package information, including metrics, suites where is present, PTS link, and the like:
  <span class="url">{{ url_prefix
    }}/api/info/package/<strong>packagename</strong>/<strong>version</strong></span>
  <a href="{{ url_prefix }}/api/info/package/davfs2/1.5.2-1/">See example</a>
</p>

<h3>Navigation in source folders and files</h3>

<p>
  List folders and files in a folder:
  <span class="url">{{ url_prefix
    }}/api/src/<strong>packagename</strong>/<strong>version</strong>/<strong>path/to/folder</strong></span>
<a href="{{ url_prefix }}/api/src/cowsay/3.03%2Bdfsg1-4/cows">See example</a>
</p>

<p>
  Get information about a file (including the raw_url of the file, which
{'fraction_non_alphanumeric': 0.1872325860003423, 'fraction_numerical': 0.01608762621940784, 'mean_word_length': 4.466791393826005, 'pattern_counts': {'":': 0, '<': 211, '<?xml version=': 0, '>': 211, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '502313', 'n_tokens_mistral': 2167, 'n_tokens_neox': 2065, 'n_words': 561}