From 5bd2af53823b2bc6b594c5f8c52cd1031efdf25a Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 19 Apr 2012 11:02:07 +0200 Subject: [PATCH] api docs --- htdocs/application/views/api_help.php | 36 ++++++++++++++++++-- htdocs/application/views/defaults/header.php | 1 + 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/htdocs/application/views/api_help.php b/htdocs/application/views/api_help.php index 1198d56..78fe038 100755 --- a/htdocs/application/views/api_help.php +++ b/htdocs/application/views/api_help.php @@ -1,8 +1,40 @@ load->view("defaults/header");?> -
+

API

- Todo. +

Create pastes from the commandline

+ +

API URL

+

+ +

POST parameters

+ + text=[your paste text] +

The paste content. Required.

+ + name=[name] +

The author's name.

+ + private=1 +

Make paste private.

+ +

Return values

+

+ On success, the API returns the paste URL in JSON format: {"url":""}
+ On error, the API returns the error message in JSON format: {"error":"missing paste text"} +

+ +

Examples

+

 

+ +

Create paste

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

Create a paste with the text 'this is my 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'.

+
load->view("defaults/footer");?> diff --git a/htdocs/application/views/defaults/header.php b/htdocs/application/views/defaults/header.php index 38ffb3e..015d5bd 100755 --- a/htdocs/application/views/defaults/header.php +++ b/htdocs/application/views/defaults/header.php @@ -35,6 +35,7 @@ $this->carabiner->display('css'); uri->segment(1)?>
  • href="" title="Create A New Paste">Create
  • uri->segment(2) != "options"){ echo 'class="active"'; }?> href="" title="Recent Pastes">Recent
  • +
  • href="" title="API">API
  • href="" title="About">About