models / api_model.php
ApiModel
Model
Manages low-level API functionality, such as calls to controllers, logging in, and uploads.
public
call
(
args = []
)
public
call
(
args = []
)
Call a controller method, sending data along and potentially requiring a user to be logged in.
Parameters
controller |
|
action |
|
data |
NULL by default. |
login_required |
TRUE by default. |
Returns
json_response
public
login
(
args = []
)
public
login
(
args = []
)
Login with username and password set in this class instance. If login is successful, set the auth ID and key in this instance, which can be then be used by the other methods requiring a logged in user. Returns the response from the Account controller's login method.
Returns
response
public
set_pass
(
args = []
)
public
set_pass
(
args = []
)
Set API password. Used in login call.
Parameters
pass |
public
set_url
(
args = []
)
public
set_url
(
args = []
)
Set API URL, used in calls and uploads.
Parameters
url |
public
set_user
(
args = []
)
public
set_user
(
args = []
)
Set API user. Used in login call.
Parameters
user |
public
upload
(
args = []
)
public
upload
(
args = []
)
Upload a file to the server. Requires being logged in with login function defined in the API code, as well as an API URL being set to locate the upload script.
Parameters
file |
Returns
curl_response