\ApiController
Synopsis
class ApiController
extends Controller
{
- // members
- protected $statusCode = NULL;
- protected $code = NULL;
- protected $data = NULL;
- protected $error = NULL;
- protected $message = NULL;
- protected $help = NULL;
- protected string $format = 'json';
- protected $parameters = NULL;
- protected $restfulSession = NULL;
- // methods
- public void init()
- public void getAccessTokenFromRequest()
- public void getSessionFromRequest()
- protected int setSessionByApiSession()
- protected void requestBodyAsArray()
- protected void requestBodyAsDataObject()
- protected void requestDataAsArray()
- protected void requestDataAsDataObject()
- protected void handleAction()
- public bool hasAction()
- public boolean checkAccessAction()
- protected void prepareApiData()
- private void sortCodeAndMessage()
- public void queryParametersToSQLFilter()
- public void sendData()
- public void sendJSON()
- public void sendError()
- public void sendSuccessfulPut()
- public void sendSuccessfulDelete()
- public void sendNotFound()
- public void sendSuccessfulPost()
- public void sendPermissionFailure()
- public void sendParameterError()
- public void isValidApiSession()
- public void sendInvalidApiSession()
Hierarchy
Extends
- Controller
Members
protected
- $code
- $data
- $error
- $format
- $help
- $message
- $parameters
- $restfulSession
- $statusCode
Methods
private
protected
- handleAction()
- prepareApiData()
- requestBodyAsArray()
- requestBodyAsDataObject()
- requestDataAsArray()
- requestDataAsDataObject()
- setSessionByApiSession() — Use the api accesstoken auth process to define a user session in SilverStripe By default SilverStripe using a form + session stored auth process, but with stateless restful we actually don't need request outlasting sessions (only for SilverStripe specifics mechanims, like Permission::check() etc.)
public
- checkAccessAction() — Checks method and action for request RequestHandler.php -> handleRequest()
- getAccessTokenFromRequest()
- getSessionFromRequest()
- hasAction() — Checks if this request handler has a specific action, even if the current user cannot access it.
- init()
- isValidApiSession()
- queryParametersToSQLFilter()
- sendData()
- sendError()
- sendInvalidApiSession()
- sendJSON()
- sendNotFound()
- sendParameterError()
- sendPermissionFailure()
- sendSuccessfulDelete()
- sendSuccessfulPost()
- sendSuccessfulPut()