/** * registers an api call * @param string $method the http method * @param string $url the url to match * @param callable $action the function to run * @param string $app the id of the app registering the call * @param int $authLevel the level of authentication required for the call (See OC_API constants) * @param array $defaults * @param array $requirements */ public static function register($method, $url, $action, $app, $authLevel = OC_API::USER_AUTH, $defaults = array(), $requirements = array()) { \OC_API::register($method, $url, $action, $app, $authLevel, $defaults, $requirements); }
<?php /** * Copyright (c) 2013, Tom Needham <*****@*****.**> * This file is licensed under the Affero General Public License version 3 or later. * See the COPYING-README file. */ // Register with the capabilities API OC_API::register('get', '/cloud/capabilities', array('OCA\\Encryption\\Capabilities', 'getCapabilities'), 'files_encryption', OC_API::USER_AUTH);
<?php /** * Copyright (c) 2013, Tom Needham <*****@*****.**> * This file is licensed under the Affero General Public License version 3 or later. * See the COPYING-README file. */ /** @var $this \OCP\Route\IRouter */ $this->create('core_ajax_versions_preview', '/preview')->action(function () { require_once __DIR__ . '/../ajax/preview.php'; }); // Register with the capabilities API OC_API::register('get', '/cloud/capabilities', array('OCA\\Files_Versions\\Capabilities', 'getCapabilities'), 'files_versions', OC_API::USER_AUTH);
<?php /** * ownCloud - External Storage Routes * * @author Vincent Petry * @copyright 2014 Vincent Petry <*****@*****.**> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE * License as published by the Free Software Foundation; either * version 3 of the License, or any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU AFFERO GENERAL PUBLIC LICENSE for more details. * * You should have received a copy of the GNU Affero General Public * License along with this library. If not, see <http://www.gnu.org/licenses/>. * */ OC_API::register('get', '/apps/files_external/api/v1/mounts', array('\\OCA\\Files\\External\\Api', 'getUserMounts'), 'files_external');
<?php /** @var $this \OCP\Route\IRouter */ $this->create('core_ajax_public_preview', '/publicpreview')->action(function () { require_once __DIR__ . '/../ajax/publicpreview.php'; }); $this->create('files_sharing_ajax_list', 'ajax/list.php')->actionInclude('files_sharing/ajax/list.php'); $this->create('sharing_external_shareinfo', '/shareinfo')->actionInclude('files_sharing/ajax/shareinfo.php'); $this->create('sharing_external_add', '/external')->actionInclude('files_sharing/ajax/external.php'); $this->create('sharing_external_test_remote', '/testremote')->actionInclude('files_sharing/ajax/testremote.php'); // OCS API //TODO: SET: mail notification, waiting for PR #4689 to be accepted OC_API::register('get', '/apps/files_sharing/api/v1/shares', array('\\OCA\\Files\\Share\\Api', 'getAllShares'), 'files_sharing'); OC_API::register('post', '/apps/files_sharing/api/v1/shares', array('\\OCA\\Files\\Share\\Api', 'createShare'), 'files_sharing'); OC_API::register('get', '/apps/files_sharing/api/v1/shares/{id}', array('\\OCA\\Files\\Share\\Api', 'getShare'), 'files_sharing'); OC_API::register('put', '/apps/files_sharing/api/v1/shares/{id}', array('\\OCA\\Files\\Share\\Api', 'updateShare'), 'files_sharing'); OC_API::register('delete', '/apps/files_sharing/api/v1/shares/{id}', array('\\OCA\\Files\\Share\\Api', 'deleteShare'), 'files_sharing');
<?php /** * ownCloud - Activity App * * @author Frank Karlitschek * @copyright 2013 Frank Karlitschek frank@owncloud.org * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE * License as published by the Free Software Foundation; either * version 3 of the License, or any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU AFFERO GENERAL PUBLIC LICENSE for more details. * * You should have received a copy of the GNU Affero General Public * License along with this library. If not, see <http://www.gnu.org/licenses/>. * */ /** @var $this OC\Route\Router */ $this->create('activity.index', '')->actionInclude('activity/index.php'); $this->create('activity.ajax.fetch', 'ajax/fetch.php')->actionInclude('activity/ajax/fetch.php'); $this->create('activity.ajax.rssfeed', 'ajax/rssfeed.php')->actionInclude('activity/ajax/rssfeed.php'); $this->create('activity.ajax.settings', 'ajax/settings.php')->actionInclude('activity/ajax/settings.php'); $this->create('activity.rss', 'rss.php')->actionInclude('activity/rss.php'); // Register an OCS API call OC_API::register('get', '/cloud/activity', array('OCA\\Activity\\Api', 'get'), 'activity');
<?php /** @var $this \OCP\Route\IRouter */ $this->create('core_ajax_trashbin_preview', 'ajax/preview.php')->actionInclude('files_trashbin/ajax/preview.php'); $this->create('files_trashbin_ajax_delete', 'ajax/delete.php')->actionInclude('files_trashbin/ajax/delete.php'); $this->create('files_trashbin_ajax_isEmpty', 'ajax/isEmpty.php')->actionInclude('files_trashbin/ajax/isEmpty.php'); $this->create('files_trashbin_ajax_list', 'ajax/list.php')->actionInclude('files_trashbin/ajax/list.php'); $this->create('files_trashbin_ajax_undelete', 'ajax/undelete.php')->actionInclude('files_trashbin/ajax/undelete.php'); // Register with the capabilities API \OC_API::register('get', '/cloud/capabilities', array('OCA\\Files_Trashbin\\Capabilities', 'getCapabilities'), 'files_trashbin', \OC_API::USER_AUTH);
<?php /** * Copyright (c) 2012, Tom Needham <*****@*****.**> * This file is licensed under the Affero General Public License version 3 or later. * See the COPYING-README file. */ // Config OC_API::register('get', '/config', array('OC_OCS_Config', 'apiConfig'), 'core', OC_API::GUEST_AUTH); // Person OC_API::register('post', '/person/check', array('OC_OCS_Person', 'check'), 'core', OC_API::GUEST_AUTH); // Privatedata OC_API::register('get', '/privatedata/getattribute', array('OC_OCS_Privatedata', 'get'), 'core', OC_API::USER_AUTH, array('app' => '', 'key' => '')); OC_API::register('get', '/privatedata/getattribute/{app}', array('OC_OCS_Privatedata', 'get'), 'core', OC_API::USER_AUTH, array('key' => '')); OC_API::register('get', '/privatedata/getattribute/{app}/{key}', array('OC_OCS_Privatedata', 'get'), 'core', OC_API::USER_AUTH); OC_API::register('post', '/privatedata/setattribute/{app}/{key}', array('OC_OCS_Privatedata', 'set'), 'core', OC_API::USER_AUTH); OC_API::register('post', '/privatedata/deleteattribute/{app}/{key}', array('OC_OCS_Privatedata', 'delete'), 'core', OC_API::USER_AUTH); // cloud OC_API::register('get', '/cloud/capabilities', array('OC_OCS_Cloud', 'getCapabilities'), 'core', OC_API::USER_AUTH); OC_API::register('get', '/cloud/users/{userid}', array('OC_OCS_Cloud', 'getUser'), 'core', OC_API::USER_AUTH); OC_API::register('get', '/cloud/user', array('OC_OCS_Cloud', 'getCurrentUser'), 'core', OC_API::USER_AUTH);
* * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License, version 3, * along with this program. If not, see <http://www.gnu.org/licenses/> * */ // Config OC_API::register('get', '/config', array('OC_OCS_Config', 'apiConfig'), 'core', OC_API::GUEST_AUTH); // Person OC_API::register('post', '/person/check', array('OC_OCS_Person', 'check'), 'core', OC_API::GUEST_AUTH); // Privatedata OC_API::register('get', '/privatedata/getattribute', array('OC_OCS_Privatedata', 'get'), 'core', OC_API::USER_AUTH, array('app' => '', 'key' => '')); OC_API::register('get', '/privatedata/getattribute/{app}', array('OC_OCS_Privatedata', 'get'), 'core', OC_API::USER_AUTH, array('key' => '')); OC_API::register('get', '/privatedata/getattribute/{app}/{key}', array('OC_OCS_Privatedata', 'get'), 'core', OC_API::USER_AUTH); OC_API::register('post', '/privatedata/setattribute/{app}/{key}', array('OC_OCS_Privatedata', 'set'), 'core', OC_API::USER_AUTH); OC_API::register('post', '/privatedata/deleteattribute/{app}/{key}', array('OC_OCS_Privatedata', 'delete'), 'core', OC_API::USER_AUTH); // cloud OC_API::register('get', '/cloud/capabilities', array('OC_OCS_Cloud', 'getCapabilities'), 'core', OC_API::USER_AUTH); OC_API::register('get', '/cloud/users/{userid}', array('OC_OCS_Cloud', 'getUser'), 'core', OC_API::USER_AUTH); OC_API::register('get', '/cloud/user', array('OC_OCS_Cloud', 'getCurrentUser'), 'core', OC_API::USER_AUTH); // Server-to-Server Sharing $s2s = new \OCA\Files_Sharing\API\Server2Server(); OC_API::register('post', '/cloud/shares', array($s2s, 'createShare'), 'files_sharing', OC_API::GUEST_AUTH); OC_API::register('post', '/cloud/shares/{id}/accept', array($s2s, 'acceptShare'), 'files_sharing', OC_API::GUEST_AUTH); OC_API::register('post', '/cloud/shares/{id}/decline', array($s2s, 'declineShare'), 'files_sharing', OC_API::GUEST_AUTH); OC_API::register('post', '/cloud/shares/{id}/unshare', array($s2s, 'unshare'), 'files_sharing', OC_API::GUEST_AUTH);
<?php /** * Copyright (c) 2012, Tom Needham <*****@*****.**> * This file is licensed under the Affero General Public License version 3 or later. * See the COPYING-README file. */ // Config OC_API::register('get', '/config', array('OC_OCS_Config', 'apiConfig'), 'core', OC_API::GUEST_AUTH); // Person OC_API::register('post', '/person/check', array('OC_OCS_Person', 'check'), 'core', OC_API::GUEST_AUTH); // Activity OC_API::register('get', '/activity', array('OC_OCS_Activity', 'activityGet'), 'core', OC_API::USER_AUTH); // Privatedata OC_API::register('get', '/privatedata/getattribute', array('OC_OCS_Privatedata', 'get'), 'core', OC_API::USER_AUTH, array('app' => '', 'key' => '')); OC_API::register('get', '/privatedata/getattribute/{app}', array('OC_OCS_Privatedata', 'get'), 'core', OC_API::USER_AUTH, array('key' => '')); OC_API::register('get', '/privatedata/getattribute/{app}/{key}', array('OC_OCS_Privatedata', 'get'), 'core', OC_API::USER_AUTH); OC_API::register('post', '/privatedata/setattribute/{app}/{key}', array('OC_OCS_Privatedata', 'set'), 'core', OC_API::USER_AUTH); OC_API::register('post', '/privatedata/deleteattribute/{app}/{key}', array('OC_OCS_Privatedata', 'delete'), 'core', OC_API::USER_AUTH); // cloud OC_API::register('get', '/cloud/capabilities', array('OC_OCS_Cloud', 'getCapabilities'), 'core', OC_API::USER_AUTH);
<?php namespace OCA\Files_Sharing\AppInfo; use OCA\Files_Sharing\Application; $application = new Application(); $application->registerRoutes($this, ['resources' => ['ExternalShares' => ['url' => '/api/externalShares']]]); /** @var $this \OCP\Route\IRouter */ $this->create('core_ajax_public_preview', '/publicpreview')->action(function () { require_once __DIR__ . '/../ajax/publicpreview.php'; }); $this->create('files_sharing_ajax_list', 'ajax/list.php')->actionInclude('files_sharing/ajax/list.php'); $this->create('files_sharing_ajax_publicpreview', 'ajax/publicpreview.php')->actionInclude('files_sharing/ajax/publicpreview.php'); $this->create('sharing_external_shareinfo', '/shareinfo')->actionInclude('files_sharing/ajax/shareinfo.php'); $this->create('sharing_external_add', '/external')->actionInclude('files_sharing/ajax/external.php'); $this->create('sharing_external_test_remote', '/testremote')->actionInclude('files_sharing/ajax/testremote.php'); // OCS API //TODO: SET: mail notification, waiting for PR #4689 to be accepted \OC_API::register('get', '/apps/files_sharing/api/v1/shares', array('\\OCA\\Files_Sharing\\API\\Local', 'getAllShares'), 'files_sharing'); \OC_API::register('post', '/apps/files_sharing/api/v1/shares', array('\\OCA\\Files_Sharing\\API\\Local', 'createShare'), 'files_sharing'); \OC_API::register('get', '/apps/files_sharing/api/v1/shares/{id}', array('\\OCA\\Files_Sharing\\API\\Local', 'getShare'), 'files_sharing'); \OC_API::register('put', '/apps/files_sharing/api/v1/shares/{id}', array('\\OCA\\Files_Sharing\\API\\Local', 'updateShare'), 'files_sharing'); \OC_API::register('delete', '/apps/files_sharing/api/v1/shares/{id}', array('\\OCA\\Files_Sharing\\API\\Local', 'deleteShare'), 'files_sharing');
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License, version 3, * along with this program. If not, see <http://www.gnu.org/licenses/> * */ namespace OCA\Files_Sharing\AppInfo; use OCA\Files_Sharing\Application; $application = new Application(); $application->registerRoutes($this, ['resources' => ['ExternalShares' => ['url' => '/api/externalShares']]]); /** @var $this \OCP\Route\IRouter */ $this->create('core_ajax_public_preview', '/publicpreview')->action(function () { require_once __DIR__ . '/../ajax/publicpreview.php'; }); $this->create('files_sharing_ajax_list', 'ajax/list.php')->actionInclude('files_sharing/ajax/list.php'); $this->create('files_sharing_ajax_publicpreview', 'ajax/publicpreview.php')->actionInclude('files_sharing/ajax/publicpreview.php'); $this->create('sharing_external_shareinfo', '/shareinfo')->actionInclude('files_sharing/ajax/shareinfo.php'); $this->create('sharing_external_add', '/external')->actionInclude('files_sharing/ajax/external.php'); $this->create('sharing_external_test_remote', '/testremote')->actionInclude('files_sharing/ajax/testremote.php'); // OCS API //TODO: SET: mail notification, waiting for PR #4689 to be accepted \OC_API::register('get', '/apps/files_sharing/api/v1/shares', array('\\OCA\\Files_Sharing\\API\\Local', 'getAllShares'), 'files_sharing'); \OC_API::register('post', '/apps/files_sharing/api/v1/shares', array('\\OCA\\Files_Sharing\\API\\Local', 'createShare'), 'files_sharing'); \OC_API::register('get', '/apps/files_sharing/api/v1/shares/{id}', array('\\OCA\\Files_Sharing\\API\\Local', 'getShare'), 'files_sharing'); \OC_API::register('put', '/apps/files_sharing/api/v1/shares/{id}', array('\\OCA\\Files_Sharing\\API\\Local', 'updateShare'), 'files_sharing'); \OC_API::register('delete', '/apps/files_sharing/api/v1/shares/{id}', array('\\OCA\\Files_Sharing\\API\\Local', 'deleteShare'), 'files_sharing'); // Register with the capabilities API \OC_API::register('get', '/cloud/capabilities', array('OCA\\Files_Sharing\\Capabilities', 'getCapabilities'), 'files_sharing', \OC_API::USER_AUTH);