<commit_before>---
layout: default
title: Playround Developer
---

<div class="row">
  <div class="large-12 columns">
    <h1>Playround Api Documentation</h1>
    <hr/>
  </div>
</div>

<div class="row">
  <div class="large-3 columns">
    <div class="section-container accordion" data-section="accordion">
      <section>
        <p class="title" data-section-title><a href="#">Basics</a></p>
        <div class="content" data-section-content>
          <ul class="side-nav">
            <li><a href="#intro">Introduction</a></li>
            <li><a href="#authentication">Authentication</a></li>
            <li><a href="#errors">Errors</a></li>
            <li><a href="#versioning">Versioning</a></li>
          </ul>
        </div>
      </section>
      <section>
        <p class="title" data-section-title><a href="#">API Objects</a></p>
        <div class="content" data-section-content>
          <ul class="side-nav">
            <li><a href="#tokens">Tokens</a></li>
          </ul>
        </div>
      </section>
    </div>
  </div>

  <div class="large-9 columns">
    <section id="basics">
      <h1>Basics</h1>

      <section id="intro">
        <h2>Introduction</h2>

        <p>
          The Playround API is organized around REST. Our API is designed to have predictable, resource-oriented URLs and to use HTTP response codes to indicate API errors. We use built-in HTTP features, like HTTP authentication and HTTP verbs, which can be understood by off-the-shelf HTTP clients. JSON will be returned in all responses from the API, including errors.
        </p>
      </section>

      <section id="authentication">
        <h2>Authentication</h2>

        <p>
          Authentication to the API occurs via HTTP Basic Token Auth. Provide your API key as a header.

          <div class="panel">
            <pre>$ curl -H "Authorization: {TOKEN}" https://api.goplayround.com</pre>
          </div>

          Requests that require authentication will return 401 if the token is not provided
        </p>
      </section>

      <section id="errors">
        <h2>Errors</h2>

        <p>
          Sending invalid fields will result in a 422 Unprocessable Entity response, including a json with the errors for the api object fields.

          Example
        </p>

        <div class="panel">
          <pre>$ curl -H "Authorization: {TOKEN}" https://api.goplayround.com/v1/rounds -d ""</pre>
        </div>

        <div class="panel">
          <pre>
HTTP/1.1 422 Unprocessable Entity

{
  "errors": {
    "game_id":["can't be blank"],
    "user_id":["can't be blank"],
    "arena_id":["can't be blank"]
  }
}
          </pre>
        </div>
      </section>

      <section id="versioning">
        <h2>Versioning</h2>

        <p>
          Version is specified as a parameter in the url, right after the domain. If you don't specify any version your requests will be redirected to the last one.
        </p>
      </section>
    </section>

    <section id="api-objects">
      <h1>API Objects</h1>

      <section id="tokens">
        <h2>Tokens</h2>
        <p>In order to obtain an authentication token you must perform a request to the /tokens endpoint providing a facebook access token.</p>

        <div class="panel">
          <pre>
POST tokens
{
  "token": { "facebook_access_token": {FB_TOKEN} }
}
          </pre>
        </div>

        <p>Response</p><commit_msg>Changed headings<commit_after>---
layout: default
title: Playround Developer
---

<div class="row">
  <div class="large-12 columns">
    <h1>Playround Api Documentation</h1>
    <hr/>
  </div>
</div>

<div class="row">
  <div class="large-3 columns">
    <div class="section-container accordion" data-section="accordion">
      <section>
        <p class="title" data-section-title><a href="#">Basics</a></p>
        <div class="content" data-section-content>
          <ul class="side-nav">
            <li><a href="#intro">Introduction</a></li>
            <li><a href="#authentication">Authentication</a></li>
            <li><a href="#errors">Errors</a></li>
            <li><a href="#versioning">Versioning</a></li>
          </ul>
        </div>
      </section>
      <section>
        <p class="title" data-section-title><a href="#">API Objects</a></p>
        <div class="content" data-section-content>
          <ul class="side-nav">
            <li><a href="#tokens">Tokens</a></li>
          </ul>
        </div>
      </section>
    </div>
  </div>

  <div class="large-9 columns">
    <section id="basics">
      <h1>Basics</h1>

      <section id="intro">
        <h3>Introduction</h3>

        <p>
          The Playround API is organized around REST. Our API is designed to have predictable, resource-oriented URLs and to use HTTP response codes to indicate API errors. We use built-in HTTP features, like HTTP authentication and HTTP verbs, which can be understood by off-the-shelf HTTP clients. JSON will be returned in all responses from the API, including errors.
        </p>
      </section>

      <section id="authentication">
        <h3>Authentication</h3>

        <p>
          Authentication to the API occurs via HTTP Basic Token Auth. Provide your API key as a header.

          <div class="panel">
            <pre>$ curl -H "Authorization: {TOKEN}" https://api.goplayround.com</pre>
          </div>

          Requests that require authentication will return 401 if the token is not provided
        </p>
      </section>

      <section id="errors">
        <h3>Errors</h3>

        <p>
          Sending invalid fields will result in a 422 Unprocessable Entity response, including a json with the errors for the api object fields.

          Example
        </p>

        <div class="panel">
          <pre>$ curl -H "Authorization: {TOKEN}" https://api.goplayround.com/v1/rounds -d ""</pre>
        </div>

        <div class="panel">
          <pre>
HTTP/1.1 422 Unprocessable Entity

{
  "errors": {
    "game_id":["can't be blank"],
    "user_id":["can't be blank"],
    "arena_id":["can't be blank"]
  }
}
          </pre>
        </div>
      </section>

      <section id="versioning">
        <h3>Versioning</h3>

        <p>
          Version is specified as a parameter in the url, right after the domain. If you don't specify any version your requests will be redirected to the last one.
        </p>
      </section>
    </section>

    <section id="api-objects">
      <h1>API Objects</h1>

      <section id="tokens">
        <h3>Tokens</h3>
        <p>In order to obtain an authentication token you must perform a request to the /tokens endpoint providing a facebook access token.</p>

        <div class="panel">
          <pre>
POST tokens
{
  "token": { "facebook_access_token": {FB_TOKEN} }
}
          </pre>
        </div>

        <p>Response</p>
{'fraction_non_alphanumeric': 0.1442208841239536, 'fraction_numerical': 0.009399324423557056, 'mean_word_length': 2.242857142857143, 'pattern_counts': {'":': 12, '<': 217, '<?xml version=': 0, '>': 217, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1483045', 'n_tokens_mistral': 2100, 'n_tokens_neox': 2009, 'n_words': 624}