OCSController

class OCP\AppFramework\OCSController
Base class to inherit your controllers from that are used for RESTful APIs
Source:lib/public/AppFramework/OCSController.php#44
Parent:OCP\AppFramework\ApiController

Constants

RESPOND_UNAUTHORISED = 997
Source:lib/public/AppFramework/OCSController.php#45
RESPOND_SERVER_ERROR = 996
Source:lib/public/AppFramework/OCSController.php#46
RESPOND_NOT_FOUND = 998
Source:lib/public/AppFramework/OCSController.php#47
RESPOND_UNKNOWN_ERROR = 999
Source:lib/public/AppFramework/OCSController.php#48

Properties

Methods

public OCP\AppFramework\OCSController::__construct($appName, $request, $corsMethods=PUT, POST, GET, DELETE, PATCH, $corsAllowedHeaders=Authorization, Content-Type, Accept, $corsMaxAge=1728000)
constructor of the controller
Source:

lib/public/AppFramework/OCSController.php#67

Parameters:
  • $appName (string) the name of the app
  • $request (OCP\IRequest) an instance of the request
  • $corsMethods (string) comma separated string of HTTP verbs which

should be allowed for websites or webapps when calling your API, defaults to ‘PUT, POST, GET, DELETE, PATCH’ * $corsAllowedHeaders (string) comma separated string of HTTP headers which should be allowed for websites or webapps when calling your API, defaults to ‘Authorization, Content-Type, Accept’ * $corsMaxAge (int) number in seconds how long a preflighted OPTIONS request should be cached, defaults to 1728000 seconds

Since:

8.1.0

public OCP\AppFramework\OCSController::setOCSVersion($version)
Source:

lib/public/AppFramework/OCSController.php#87

Parameters:
  • $version (int)
Since:

11.0.0

public OCP\AppFramework\OCSController::buildResponse($response, $format=xml)
Since the OCS endpoints default to XML we need to find out the format
again
Source:

lib/public/AppFramework/OCSController.php#101

Parameters:
  • $response (mixed) the value that was returned from a controller and

is not a Response instance * $format (string) the format for which a formatter has been registered

Throws:

\DomainException if format does not match a registered formatter

Returns:

\OCP\AppFramework\Http\Response

Since:

9.1.0