diff --git a/web/html/rpc.php b/web/html/rpc.php
index 30813912..033cba59 100644
--- a/web/html/rpc.php
+++ b/web/html/rpc.php
@@ -10,9 +10,22 @@ if ( $_SERVER['REQUEST_METHOD'] == 'GET' ) {
if ( isset($_GET['type']) ) {
echo $rpc_o->handle($_GET);
}
- else {
+ else {
+ // dump a simple usage output for people to use.
+ // this could be moved to an api doc in the future, or generated from
+ // the AurJSON class directly with phpdoc. For now though, just putting it here.
echo '
';
- echo $rpc_o->usage();
+ echo 'The methods currently allowed are:
';
+ echo '';
+ echo '- search
';
+ echo '- info
';
+ echo '
';
+ echo 'Each method requires the following HTTP GET syntax:
';
+ echo ' type=methodname&arg=data
';
+ echo 'Where methodname is the name of an allowed method, and data is the argument to the call.
';
+ echo '
';
+ echo 'If you need jsonp type callback specification, you can provide an additional variable callback.
';
+ echo 'Example URL:
http://aur-url/rpc.php?type=search&arg=foobar&callback=jsonp1192244621103';
echo '';
}
}
diff --git a/web/lib/aurjson.class.php b/web/lib/aurjson.class.php
index ce59ed7d..d12f2b54 100644
--- a/web/lib/aurjson.class.php
+++ b/web/lib/aurjson.class.php
@@ -19,26 +19,6 @@ class AurJSON {
private $dbh = false;
private $exposed_methods = array('search','info');
- /**
- * Returns the usage data for the exposed json api.
- * @return string The usage data in plain format.
- **/
- public function usage() {
- $usage = 'The methods currently allowed are:
';
- $usage .= '';
- foreach ($this->exposed_methods as $methodname) {
- $usage .= "- {$methodname}
";
- }
- $usage .= '
';
- $usage .= 'Each method requires the following HTTP GET syntax:
';
- $usage .= ' type=_methodname_&arg=_data_
';
- $usage .= 'Where _methodname_ is the name of an exposed method, and _data_ is the data supplied as part of the call.
';
- $usage .= 'The _ characters are included only in this example as placeholders. Do not use them in an actual query.
';
- $usage .= 'If you need jsonp type callback specification, you can provide an additional variable "callback".
';
- $usage .= 'Example URL:
http://aur-url/rpc.php?type=search&args=foobar&callback=jsonp1192244621103';
- return $usage;
- }
-
/**
* Handles post data, and routes the request.
* @param string $post_data The post data to parse and handle.
@@ -46,7 +26,7 @@ class AurJSON {
**/
public function handle($http_data) {
// set content type header to json
- //header('content-type: application/json');
+ header('content-type: application/json');
// set up db connection.
$this->dbh = db_connect();