This commit is contained in:
Claude 2012-04-19 11:13:58 +02:00
parent 5bd2af5382
commit 04db74191e
2 changed files with 19 additions and 4 deletions

View File

@ -20,7 +20,11 @@ class Api extends Main
function index()
{
$this->load->view('api_help');
$languages = $this->languages->get_languages();
$languages = array_keys($languages);
$languages = implode(', ', $languages);
$data['languages'] = $languages;
$this->load->view('api_help', $data);
}
function create()

View File

@ -7,7 +7,14 @@
<h2>API URL</h2>
<p class="explain"><code><?php echo site_url('api/create'); ?></code></p>
<h2>Return values</h2>
<p class="explain">
On success, the API returns the paste URL in JSON format: <code>{"url":"<?php echo site_url('view/68582786'); ?>"}</code><br />
On error, the API returns the error message in JSON format: <code>{"error":"missing paste text"}</code>
</p>
<h2>POST parameters</h2>
<p>&nbsp;</p>
<code>text=[your paste text]</code>
<p class="explain">The paste content. Required.</p>
@ -18,10 +25,10 @@
<code>private=1</code>
<p class="explain">Make paste private.</p>
<h2>Return values</h2>
<code>lang=[language]</code>
<p class="explain">
On success, the API returns the paste URL in JSON format: <code>{"url":"<?php echo site_url('view/68582786'); ?>"}</code><br />
On error, the API returns the error message in JSON format: <code>{"error":"missing paste text"}</code>
Use alternative syntax highlighting.<br />
Possible values: <?php echo $languages; ?>
</p>
<h2>Examples</h2>
@ -35,6 +42,10 @@
<code>curl -d private=1 -d name=Herbert --data-urlencode text@/etc/passwd <?php echo site_url('api/create'); ?></code>
<p class="explain">Create a private paste with the author 'Herbert' and the contents of '/etc/passwd'.</p>
<h3>Create paste from a php file</h3>
<code>curl -d lang=php --data-urlencode text@main.php <?php echo site_url('api/create'); ?></code>
<p class="explain">Create a paste with PHP syntax highlighting.</p>
</div>
<?php $this->load->view("defaults/footer");?>