diff --git a/htdocs/application/controllers/api.php b/htdocs/application/controllers/api.php index f6e6157..afe2be6 100644 --- a/htdocs/application/controllers/api.php +++ b/htdocs/application/controllers/api.php @@ -9,6 +9,7 @@ * - random() * - recent() * - trending() + * - langs() * Classes list: * - Api extends Main */ @@ -168,4 +169,10 @@ class Api extends Main } echo json_encode($data); } + + function langs() + { + $languages = $this->languages->get_languages(); + echo json_encode($languages); + } } diff --git a/htdocs/themes/bootstrap/views/api_help.php b/htdocs/themes/bootstrap/views/api_help.php index 28e0cc1..d2110fc 100644 --- a/htdocs/themes/bootstrap/views/api_help.php +++ b/htdocs/themes/bootstrap/views/api_help.php @@ -24,6 +24,9 @@

Get trending pastes

+

List available languages

+

+

Create a paste

diff --git a/htdocs/themes/default/views/api_help.php b/htdocs/themes/default/views/api_help.php index 5caa976..a29fcaf 100644 --- a/htdocs/themes/default/views/api_help.php +++ b/htdocs/themes/default/views/api_help.php @@ -19,6 +19,9 @@

Get trending pastes

+

List available languages

+

+

Create a paste

diff --git a/htdocs/themes/geocities/views/api_help.php b/htdocs/themes/geocities/views/api_help.php index 5caa976..d2110fc 100644 --- a/htdocs/themes/geocities/views/api_help.php +++ b/htdocs/themes/geocities/views/api_help.php @@ -1,75 +1,83 @@ load->view("defaults/header");?> -
-

API

-

Create pastes from the commandline

+
+
+ +
+
+

Create pastes from the commandline

-

API URL

-

+

API URL

+

-

Get paste

-

+

Get paste

+

-

Get random paste

-

+

Get random paste

+

-

Get recent pastes

-

+

Get recent pastes

+

-

Get trending pastes

-

+

Get trending pastes

+

-

Create a paste

-

+

List available languages

+

-

POST parameters

- text=[your paste text] -

The paste content. Required.

+

Create a paste

+

- title=[title] -

Title for the paste.

+

POST parameters

+ text=[your paste text] +

The paste content. Required.

- name=[name] -

The author's name.

+ title=[title] +

Title for the paste.

- private=1 -

Make paste private.

+ name=[name] +

The author's name.

- lang=[language] -

- Use alternative syntax highlighting.
- Possible values: -

+ private=1 +

Make paste private.

- expire=[minutes] -

Set paste expiration.

+ lang=[language] +

+ Use alternative syntax highlighting.
+ Possible values: +

- reply=[pasteid] -

Reply to existing paste.

+ expire=[minutes] +

Set paste expiration.

-

Return values

-

- On success, the API returns the paste URL:
- On error, the API returns the error message: Error: Missing paste text -

+ reply=[pasteid] +

Reply to existing paste.

-

Examples

-

Create paste

- curl -d text='this is my text' -

Create a paste with the text 'this is my text'.

+

Return values

+

+ On success, the API returns the paste URL:
+ On error, the API returns the error message: Error: Missing paste text +

-

Create paste from a file

- curl -d private=1 -d name=Herbert --data-urlencode text@/etc/passwd -

Create a private paste with the author 'Herbert' and the contents of '/etc/passwd'.

+

Examples

+

Create paste

+ curl -d text='this is my text' +

Create a paste with the text 'this is my text'.

-

Create paste from a php file

- curl -d lang=php --data-urlencode text@main.php -

Create a paste with PHP syntax highlighting.

+

Create paste from a file

+ curl -d private=1 -d name=Herbert --data-urlencode text@/etc/passwd +

Create a private paste with the author 'Herbert' and the contents of '/etc/passwd'.

-

Get paste ;-)

- curl -

Display paste.

+

Create paste from a php file

+ curl -d lang=php --data-urlencode text@main.php +

Create a paste with PHP syntax highlighting.

+

Get paste ;-)

+ curl +

Display paste.

+
load->view("defaults/footer");?>