summaryrefslogtreecommitdiffstats
path: root/lib/api.php
diff options
context:
space:
mode:
authorBart Visscher <bartv@thisnet.nl>2012-07-31 23:26:15 +0200
committerBart Visscher <bartv@thisnet.nl>2012-07-31 23:26:15 +0200
commit7426217e760601f684c402bf363a51bb8c79947c (patch)
tree80493de62477a4658fbf50ca001afaa59ac89450 /lib/api.php
parent71918a820f0e5b7e9479711107db059cd3a3b194 (diff)
downloadnextcloud-server-7426217e760601f684c402bf363a51bb8c79947c.tar.gz
nextcloud-server-7426217e760601f684c402bf363a51bb8c79947c.zip
Fix /privatedata/getattribute route
Diffstat (limited to 'lib/api.php')
-rw-r--r--lib/api.php10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/api.php b/lib/api.php
index 203b07880fd..cf699f547f3 100644
--- a/lib/api.php
+++ b/lib/api.php
@@ -38,14 +38,16 @@ class OC_API {
* @param callable $action the function to run
* @param string $app the id of the app registering the call
*/
- public static function register($method, $url, $action, $app){
+ public static function register($method, $url, $action, $app,
+ $defaults = array(),
+ $requirements = array()){
$name = strtolower($method).$url;
$name = str_replace(array('/', '{', '}'), '_', $name);
if(!isset(self::$actions[$name])){
OC::$router->create($name, $url.'.{_format}')
->method($method)
- ->defaults(array('_format' => 'xml'))
- ->requirements(array('_format' => 'xml|json'))
+ ->defaults(array('_format' => 'xml') + $defaults)
+ ->requirements(array('_format' => 'xml|json') + $requirements)
->action('OC_API', 'call');
self::$actions[$name] = array();
}
@@ -112,7 +114,7 @@ class OC_API {
private static function respond($response, $format='json'){
if ($format == 'json') {
echo json_encode($response);
- } else if ($format == 'xml') {
+ //} else if ($format == 'xml') {
// TODO array to xml
} else {
var_dump($format, $response);