RESTfulController.php
Table of Contents
Classes
Functions
- bb_register_REST_api() : void
- Registers a RESTful API method
- bb_get_request_method() : string
- Returns the Request Method of the current request (GET, POST, PUT, DELETE)
- bb_get_json_payload() : mixed
- Returns the JSON payload of the current request
Functions
bb_register_REST_api()
Registers a RESTful API method
bb_register_REST_api(float $version, mixed $requestMethod, mixed $alias, callable $function[, bool $requiresAuth = false ][, mixed $requiredPermission = null ][, mixed $requiredFields = null ]) : void
Parameters
- $version : float
- $requestMethod : mixed
-
The request method (GET, POST, PUT, DELETE)
- $alias : mixed
-
Path of the API (e.g. "category/method")
- $function : callable
-
The function that should be called when the API is requested (must accept one parameter for the payload)
- $requiresAuth : bool = false
-
True if the API requires authentication
- $requiredPermission : mixed = null
-
The permission that is required to access the API if it requires authentication
- $requiredFields : mixed = null
-
The fields that are required in the payload
bb_get_request_method()
Returns the Request Method of the current request (GET, POST, PUT, DELETE)
bb_get_request_method() : string
Return values
stringbb_get_json_payload()
Returns the JSON payload of the current request
bb_get_json_payload() : mixed