ApiController

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

Properties

Methods

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

lib/public/AppFramework/ApiController.php#58

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:

7.0.0

public OCP\AppFramework\ApiController::preflightedCors()
This method implements a preflighted cors response for you that you can
link to for the options request
Source:lib/public/AppFramework/ApiController.php#79
Since:7.0.0