<div class="page-margin">
   <div class="wowonder-well one-well">
      <h3 class="bold"><strong>API Documentation (API Version: 1.0)</strong></h3>
      <p>Our API allows you to retrieve informations from our website via GET request and supports the following query parameters: </p>
      <table class="table  table-condensed">
         <thead>
            <tr>
               <th>Name</th>
               <th>Required</th>
               <th>Meaning</th>
               <th>Description</th>
            </tr>
         </thead>
         <tbody>
            <tr>
               <td><b>f</b></td>
               <td><i class="fa fa-check"></i></td>
               <td>Query type.</td>
               <td>This parameter specify the type of the query, 'user_data' is for profile informations, 'posts_data' is for posts informations.</td>
            </tr>
            <tr>
               <td><b>u</b></td>
               <td><i class="fa fa-check"></i></td>
               <td>Username.</td>
               <td>This parameter specify the username, for profile informations, and posts informations.</td>
            </tr>
            <tr>
               <td><b>l</b></td>
               <td><i class="fa fa-remove"></i></td>
               <td>Items limit.</td>
               <td>This parameter specify the limit of result (max: 50 per request)</td>
            </tr>
            <tr>
               <td><b>k</b></td>
               <td><i class="fa fa-remove"></i></td>
               <td>Search keyword.</td>
               <td>This parameter specify the search keyword</td>
            </tr>
         </tbody>
      </table>
      <h4>Examples of requests:</h4>
      <br>
      For profile information from an user: <br>
      <code><?php echo $wo['config']['site_url'];?>/api.php?f=user_data&u=USERNAME</code> 
      <br><br>
      For a list of users from a keyword: <br>
      <code><?php echo $wo['config']['site_url'];?>/api.php?f=search&l=40&k=KEYWORD</code>
      <br><br>
      For a list of posts from an user: <br>
      <code><?php echo $wo['config']['site_url'];?>/api.php?f=posts_data&l=40&u=USERNAME</code>
      <br><br>
      <h4>An example of json decoding</h4>
      <br>
      PHP:
      <code>
         <?php
            $code = '<?php
header(\'Content-Type: text/plain; charset=utf-8;\'); 
$json_file = file_get_contents("' . $wo['config']['site_url'] . '/api.php?f=user_data&u=USERNAME");';
echo '<pre>' . htmlspecialchars($code) . '</pre>';
         ?>
<pre>
<b>Json</b>output
{
    "api_status": "success",
    "api_version": "1.0",
    "user_data": {
        "id": "",
        "username": "",
        "first_name": "",
        "last_name": "",
        "gender": "",
        "birthday": "",
        "about": "",
        "website": "",
        "facebook": "",
        "twitter": "",
        "vk": "",
        "google+": "",
        "profile_picture": "",
        "cover_picture": "",
        "verified": ""
    }
}
</pre>
<?php
$code = '$json_data = json_decode($json_file);
print_r($json_data);
?>';
echo '<pre>' . htmlspecialchars($code) . '</pre>';
?>
<pre>
<b>PHP array</b>output
Array
(
    [api_status] => success
    [api_version] => 1.0
    [user_data] => Array
        (
            [id] => 
            [username] => 
            [first_name] => 
            [last_name] => 
            [gender] => 
            [birthday] => 
            [about] => 
            [website] => 
            [facebook] => 
            [twitter] => 
            [vk] => 
            [google+] => 
            [profile_picture] => 
            [cover_picture] => 
            [verified] => 
        )

)
</pre>
      </code>
      <br>
      JavaScript:
      <code>
         <pre>var url = '<?php echo $wo['config']['site_url'];?>/api.php?f=user_data&u=USERNAME';
$.getJSON(url, function (json) {
    ....
});</pre>
      </code>
   </div>
</div>