| Current Path : /home/users/unlimited/www/facebook.codeskitter.site/themes/sunshine/layout/terms/ |
| Current File : /home/users/unlimited/www/facebook.codeskitter.site/themes/sunshine/layout/terms/developers.phtml |
<div class="page-margin">
<div class="wowonder-well one-well">
<h3 class="bold"><strong>API Documentation (API Version: 1.3.1)</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-striped table-bordered table-condensed">
<thead>
<tr>
<th>Name</th>
<th>Meaning</th>
<th>Values</th>
<th>Description</th>
<th>Required</th>
</tr>
</thead>
<tbody>
<tr>
<td><b>type</b></td>
<td>Query type.</td>
<td>user_data,posts_data,search</td>
<td>This parameter specify the type of the query.</td>
<td><i class="fa fa-check"></i></td>
</tr>
<tr>
<td><b>user</b></td>
<td>Username.</td>
<td>USERNAME</td>
<td>This parameter specify the username</td>
<td><i class="fa fa-check"></i></td>
</tr>
<tr>
<td><b>keyword</b></td>
<td>Keyword for search</td>
<td>KEYWORD</td>
<td>This parameter specify the search keyword</td>
<td><i class="fa fa-check"></i></td>
</tr>
<tr>
<td><b>limit</b></td>
<td>Limit of items.</td>
<td>LIMIT</td>
<td>This parameter specify the limit of items. Max:100 | Default:20</td>
<td><i class="fa fa-remove"></i></td>
</tr>
<tr>
<td><b>gender</b></td>
<td>Gender filter for search</td>
<td>male,female</td>
<td>This parameter specify the users gender</td>
<td><i class="fa fa-remove"></i></td>
</tr>
<tr>
<td><b>image</b></td>
<td>Avatar filter for search</td>
<td>yes,no</td>
<td>This parameter specify the users avatar</td>
<td><i class="fa fa-remove"></i></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?type=user_data&user=<span class="black-color">USERNAME</span></code>
<br><br>
For a list of posts from an user: <br>
<code><?php echo $wo['config']['site_url'];?>/api.php?type=posts_data&user=<span class="black-color">USERNAME</span>&limit=<span class="black-color">LIMIT</span></code>
<br><br>
For a list of users from search: <br>
<code><?php echo $wo['config']['site_url'];?>/api.php?type=search&keyword=<span class="black-color">KEYWORD</span>&limit=<span class="black-color">LIMIT</span>&image=yes&gender=male</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?type=user_data&user=USERNAME");';
echo '<pre>' . htmlspecialchars($code) . '</pre>';
?>
<pre>
<b>Json</b>output
{
"api_status": "success",
"api_version": "1.3",
"user_data": {
"id": "",
"username": "",
"first_name": "",
"last_name": "",
"gender": "",
"birthday": "",
"about": "",
"website": "",
"facebook": "",
"twitter": "",
"vk": "",
"google+": "",
"profile_picture": "",
"cover_picture": "",
"verified": "",
"url": ""
}
}
</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.3
[user_data] => Array
(
[id] =>
[username] =>
[first_name] =>
[last_name] =>
[gender] =>
[birthday] =>
[about] =>
[website] =>
[facebook] =>
[twitter] =>
[vk] =>
[google+] =>
[profile_picture] =>
[cover_picture] =>
[verified] =>
[url] =>
)
)
</pre>
</code>
<br>
JavaScript:
<code>
<pre>var url = '<?php echo $wo['config']['site_url'];?>/api.php?type=user_data&user=USERNAME';
$.getJSON(url, function (json) {
....
});</pre>
</code>
<br>
C#:
<code>
<pre>using (var webClient = new System.Net.WebClient()) {
var json = webClient.DownloadString(URL);
// Now parse with JSON.Net
}</pre>
</code>
</div>
</div>