<commit_before><div class="help">
  <h1>Help: API 1.13.0+update.2</h1>

  <div class="section">
    <p>Moebooru offers API which is mostly compatible with Danbooru API (version 1.13.0) to make scripting easy. All you need is a way to <a href="http://en.wikipedia.org/wiki/HTTP_GET#Request_methods">GET and POST</a> to <a href="http://en.wikipedia.org/wiki/Uniform_Resource_Locator">URLs</a>. The ability to parse <a href="http://en.wikipedia.org/wiki/Xml">XML</a> or <a href="http://en.wikipedia.org/wiki/Json">JSON</a> responses is nice, but not critical. The simplicity of the API means you can write scripts using JavaScript, Perl, Python, Ruby, even shell languages like bash or tcsh.</p>
    <p style="text-align: center;"><a href="#changelog">Change Log</a> | <a href="#posts">Posts</a> | <a href="#tags">Tags</a> | <a href="#artists">Artists</a> | <a href="#comments">Comments</a> | <a href="#wiki">Wiki</a> | <a href="#notes">Notes</a> | <a href="#users">Users</a> | <a href="#forum">Forum</a> | <a href="#pools">Pools</a></p>
  </div>

  <div class="section">
    <div class="section">
      <h2>Basics</h2>
      <p>HTTP defines two request methods: GET and POST. You'll be using these two methods to interact with the Danbooru API. Most API calls that change the state of the database (like creating, updating, or deleting something) require an HTTP POST call. API calls that only retrieve data can typically be done with an HTTP GET call.</p>
      <p>In the Danbooru API, a URL is analogous to a function name. You pass in the function parameters as a query string. Here's an extremely simple example: <a class="code" href="http://miezaru.donmai.us/post/index.xml?limit=1" target="_blank">/post/index.xml?limit=1</a>.</p>
      <p>The <code>post</code> part indicates the controller we're working with. In this case it's posts. <code>index</code> describes the action. Here we're retrieving a list of posts. Finally, the <code>xml</code> part describes what format we want the response in. You can specify <code>.xml</code> for XML responses, <code>.json</code> for JSON responses, and nothing at all for HTML responses.</p>
    </div>

    <div class="section">
      <h4>Responses</h4>
      <p>All API calls that change state will return a single element response (for XML calls). They are formatted like this:</p>
      <div class="code">
        &lt;?xml version="1.0" encoding="UTF-8"?&gt;<br>
        &lt;response success="false" reason="duplicate"/&gt;
      </div>
      <p>For JSON responses, they'll look like this:</p>
      <div class="code">
        {success: false, reason: "duplicate"}
      </div>
      <p>While you can usually determine success or failure based on the response object, you can also figure out what happened based on the HTTP status code. In addition to the standard ones, Danbooru uses some custom status codes in the 4xx and 5xx range.</p>
      <table>
        <thead>
          <tr>
            <th>Status Code</th>
            <th>Meaning</th><commit_msg>help/api use relative link instead of dead one<commit_after><div class="help">
  <h1>Help: API 1.13.0+update.2</h1>

  <div class="section">
    <p>Moebooru offers API which is mostly compatible with Danbooru API (version 1.13.0) to make scripting easy. All you need is a way to <a href="http://en.wikipedia.org/wiki/HTTP_GET#Request_methods">GET and POST</a> to <a href="http://en.wikipedia.org/wiki/Uniform_Resource_Locator">URLs</a>. The ability to parse <a href="http://en.wikipedia.org/wiki/Xml">XML</a> or <a href="http://en.wikipedia.org/wiki/Json">JSON</a> responses is nice, but not critical. The simplicity of the API means you can write scripts using JavaScript, Perl, Python, Ruby, even shell languages like bash or tcsh.</p>
    <p style="text-align: center;"><a href="#changelog">Change Log</a> | <a href="#posts">Posts</a> | <a href="#tags">Tags</a> | <a href="#artists">Artists</a> | <a href="#comments">Comments</a> | <a href="#wiki">Wiki</a> | <a href="#notes">Notes</a> | <a href="#users">Users</a> | <a href="#forum">Forum</a> | <a href="#pools">Pools</a></p>
  </div>

  <div class="section">
    <div class="section">
      <h2>Basics</h2>
      <p>HTTP defines two request methods: GET and POST. You'll be using these two methods to interact with the Danbooru API. Most API calls that change the state of the database (like creating, updating, or deleting something) require an HTTP POST call. API calls that only retrieve data can typically be done with an HTTP GET call.</p>
      <p>In the Danbooru API, a URL is analogous to a function name. You pass in the function parameters as a query string. Here's an extremely simple example: <a class="code" href="/post/index.xml?limit=1" target="_blank">/post/index.xml?limit=1</a>.</p>
      <p>The <code>post</code> part indicates the controller we're working with. In this case it's posts. <code>index</code> describes the action. Here we're retrieving a list of posts. Finally, the <code>xml</code> part describes what format we want the response in. You can specify <code>.xml</code> for XML responses, <code>.json</code> for JSON responses, and nothing at all for HTML responses.</p>
    </div>

    <div class="section">
      <h4>Responses</h4>
      <p>All API calls that change state will return a single element response (for XML calls). They are formatted like this:</p>
      <div class="code">
        &lt;?xml version="1.0" encoding="UTF-8"?&gt;<br>
        &lt;response success="false" reason="duplicate"/&gt;
      </div>
      <p>For JSON responses, they'll look like this:</p>
      <div class="code">
        {success: false, reason: "duplicate"}
      </div>
      <p>While you can usually determine success or failure based on the response object, you can also figure out what happened based on the HTTP status code. In addition to the standard ones, Danbooru uses some custom status codes in the 4xx and 5xx range.</p>
      <table>
        <thead>
          <tr>
            <th>Status Code</th>
            <th>Meaning</th>
{'fraction_non_alphanumeric': 0.14340248962655602, 'fraction_numerical': 0.007302904564315353, 'mean_word_length': 3.7863383637807786, 'pattern_counts': {'":': 0, '<': 165, '<?xml version=': 2, '>': 165, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 10}, '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': '1975613', 'n_tokens_mistral': 1874, 'n_tokens_neox': 1810, 'n_words': 690}