Class Api
A RESTful API system for interacting with the Blesta backend.
All public model methods are accessible. Plugin models may also be invoked by simply formatting the model as Plugin.Model (e.g. /api/plugin.model/method.format). Supports XML, JSON, and PHP as format types.
Copyright: Copyright (c) 2010, Phillips Data, Inc.
License: The Blesta License Agreement
Link: Blesta
Located at app/controllers/api.php
Methods summary
public
|
#
preAction( )
Verify that the request is properly formatted, and ensure the requester is authorized. |
public
|
|
private
array
|
#
matchParameters( array $parameters = null )
Matches the given parameters with those defined in the requested method. |
private
|
#
response( string $response, mixed $data = null, boolean $encode = true )
Outputs the response and data of the current Request in the desired format |
private
string
|
|
private
boolean
|
|
private
string
|
Methods inherited from AppController
__construct()
,
authorized()
,
flashMessage()
,
getCompany()
,
getDaysOfWeek()
,
getMonths()
,
getTimes()
,
getWidgets()
,
isAjax()
,
isLoggedIn()
,
isStaffAsClient()
,
licenseCheck()
,
outputAsJson()
,
postAction()
,
primeCompany()
,
renderAjaxWidget()
,
renderAjaxWidgetIfAsync()
,
reorderWidgets()
,
requireLogin()
,
setMessage()
,
setWidgetState()
,
toggleWidget()
Methods inherited from Controller
clearCache()
,
components()
,
draw()
,
emptyCache()
,
helpers()
,
partial()
,
redirect()
,
render()
,
set()
,
setDefaultViewPath()
,
startCaching()
,
stopCaching()
,
uses()
Magic methods summary
Constants summary
string |
OK |
"OK" |
|
string |
NOT_FOUND |
"The requested resource does not exist." |
|
string |
UNAUTHORIZED |
"The authorization details given appear to be invalid." |
|
string |
FORBIDDEN |
"The requested resource is not accessible." |
|
string |
UNSUPPORTED_FORMAT |
"The format requested is not supported by the server." |
|
string |
MAINTENANCE_MODE |
"The requested resource is currently unavailable due to maintenance." |
|
string |
INTERNAL_ERROR |
"An unexpected error occured." |
|
string |
BAD_REQUEST |
"The request cannot be fulfilled due to bad syntax." |
Properties summary
private static
array
|
$formats |
#
The available output formats |
private
string
|
$format |
#
The current output format |
private
string
|
$model |
#
The full model string (e.g. Plugin.Model) |
private
string
|
$model_name |
#
The model name to load (e.g. Model) |
private
string
|
$method |
#
The method of the model to execute |
private
mixed
|
$errors |
#
An array containing all errors set by the model, false if no errors set |
private
string
|
$request_method |
#
The request method (POST, GET, PUT, DELETE) |
Properties inherited from AppController
$admin_uri
,
$base_uri
,
$base_url
,
$client_uri
,
$company_id
,
$components
,
$helpers
,
$layout
,
$request_uri
,
$server_protocol
Properties inherited from Controller
$action
,
$controller
,
$files
,
$get
,
$is_cli
,
$plugin
,
$post
,
$structure
,
$structure_view
,
$uri
,
$uri_str
,
$uses
,
$view