Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
|
This is the external API for this tool. More...
Static Public Member Functions | |
static | call_external_function ($function, $args, $ajaxonly=false) |
Call an external function validating all params/returns correctly. More... | |
static | call_external_functions ($requests) |
Call multiple external functions and return all responses. More... | |
static | call_external_functions_parameters () |
Returns description of method parameters. More... | |
static | call_external_functions_returns () |
Returns description of method result value. More... | |
static | clean_returnvalue (external_description $description, $response) |
Clean response If a response attribute is unknown from the description, we just ignore the attribute. More... | |
static | external_function_info ($function, $strictness=MUST_EXIST) |
Returns detailed function information. More... | |
static | get_autologin_key ($privatetoken) |
Creates an auto-login key for the current user. More... | |
static | get_autologin_key_parameters () |
Returns description of get_autologin_key() parameters. More... | |
static | get_autologin_key_returns () |
Returns description of get_autologin_key() result value. More... | |
static | get_config ($section='') |
Returns a list of site settings, filtering by section. More... | |
static | get_config_parameters () |
Returns description of get_config() parameters. More... | |
static | get_config_returns () |
Returns description of get_config() result value. More... | |
static | get_content ($component, $method, $args=array()) |
Returns a piece of content to be displayed in the Mobile app, it usually returns a template, javascript and other structured data that will be used to render a view in the Mobile app. More... | |
static | get_content_parameters () |
Returns description of get_content() parameters. More... | |
static | get_content_returns () |
Returns description of get_content() result value. More... | |
static | get_plugins_supporting_mobile () |
Returns a list of Moodle plugins supporting the mobile app. More... | |
static | get_plugins_supporting_mobile_parameters () |
Returns description of get_plugins_supporting_mobile() parameters. More... | |
static | get_plugins_supporting_mobile_returns () |
Returns description of get_plugins_supporting_mobile() result value. More... | |
static | get_public_config () |
Returns a list of the site public settings, those not requiring authentication. More... | |
static | get_public_config_parameters () |
Returns description of get_public_config() parameters. More... | |
static | get_public_config_returns () |
Returns description of get_public_config() result value. More... | |
static | get_tokens_for_qr_login ($qrloginkey, $userid) |
Returns a WebService token (and private token) for QR login. More... | |
static | get_tokens_for_qr_login_parameters () |
Returns description of get_tokens_for_qr_login() parameters. More... | |
static | get_tokens_for_qr_login_returns () |
Returns description of get_tokens_for_qr_login() result value. More... | |
static | set_context_restriction ($context) |
Set context restriction for all following subsequent function calls. More... | |
static | set_timeout ($seconds=360) |
This method has to be called before every operation that takes a longer time to finish! More... | |
static | validate_context ($context) |
Makes sure user may execute functions in this context. More... | |
static | validate_parameters (external_description $description, $params) |
Validates submitted function parameters, if anything is incorrect invalid_parameter_exception is thrown. More... | |
static | validate_subscription_key (string $key) |
Check if the given site subscription key is valid. More... | |
static | validate_subscription_key_parameters () |
Returns description of validate_subscription_key() parameters. More... | |
static | validate_subscription_key_returns () |
Returns description of validate_subscription_key() result value. More... | |
Static Protected Member Functions | |
static | get_context_from_params ($param) |
Get context from passed parameters. More... | |
static | get_context_parameters () |
Returns a prepared structure to use a context parameters. More... | |
This is the external API for this tool.
|
staticinherited |
Call an external function validating all params/returns correctly.
Note that an external function may modify the state of the current page, so this wrapper saves and restores tha PAGE and COURSE global variables before/after calling the external function.
string | $function | A webservice function name. |
array | $args | Params array (named params) |
boolean | $ajaxonly | If true, an extra check will be peformed to see if ajax is required. |
array | containing keys for error (bool), exception and data. |
|
static |
Call multiple external functions and return all responses.
array | $requests | List of requests. |
array | Responses. |
|
static |
Returns description of method parameters.
external_function_parameters |
|
static |
|
staticinherited |
Clean response If a response attribute is unknown from the description, we just ignore the attribute.
If a response attribute is incorrect, invalid_response_exception is thrown. Note: this function is similar to validate parameters, however it is distinct because parameters validation must be distinct from cleaning return values.
external_description | $description | description of the return values |
mixed | $response | the actual response |
mixed | response with added defaults for optional items, invalid_response_exception thrown if any problem found |
|
staticinherited |
Returns detailed function information.
string | object | $function | name of external function or record from external_function |
int | $strictness | IGNORE_MISSING means compatible mode, false returned if record not found, debug message if more found; MUST_EXIST means throw exception if no record or multiple records found |
stdClass | description or false if not found or exception thrown |
|
static |
Creates an auto-login key for the current user.
Is created only in https sites and is restricted by time and ip address.
Please note that it only works if the request comes from the Moodle mobile or desktop app.
string | $privatetoken | the user private token for validating the request |
array | with the settings and warnings |
|
static |
Returns description of get_autologin_key() parameters.
external_function_parameters |
|
static |
Returns description of get_autologin_key() result value.
external_description |
|
static |
Returns a list of site settings, filtering by section.
string | $section | settings section name |
array | with the settings and warnings |
|
static |
Returns description of get_config() parameters.
external_function_parameters |
|
static |
Returns description of get_config() result value.
external_description |
|
static |
Returns a piece of content to be displayed in the Mobile app, it usually returns a template, javascript and other structured data that will be used to render a view in the Mobile app.
Callbacks (placed in $component::output::mobile) that are called by this web service are responsible for doing the appropriate security checks to access the information to be returned.
string | $component | name of the component. |
string | $method | function method name in class $component::output::mobile. |
array | $args | optional arguments for the method. |
array | HTML, JavaScript and other required data and information to create a view in the app. |
coding_exception |
|
static |
Returns description of get_content() parameters.
external_function_parameters |
|
static |
|
staticprotectedinherited |
Get context from passed parameters.
The passed array must either contain a contextid or a combination of context level and instance id to fetch the context. For example, the context level can be "course" and instanceid can be courseid.
See context_helper::get_all_levels() for a list of valid context levels.
array | $param |
invalid_parameter_exception |
context |
|
staticprotectedinherited |
Returns a prepared structure to use a context parameters.
external_single_structure |
Reimplemented in tool_lp\external, and core_competency\external.
|
static |
Returns a list of Moodle plugins supporting the mobile app.
array | an array of warnings and objects containing the plugin information |
|
static |
Returns description of get_plugins_supporting_mobile() parameters.
external_function_parameters |
|
static |
Returns description of get_plugins_supporting_mobile() result value.
external_description |
|
static |
Returns a list of the site public settings, those not requiring authentication.
array | with the settings and warnings |
|
static |
Returns description of get_public_config() parameters.
external_function_parameters |
|
static |
Returns description of get_public_config() result value.
external_description |
|
static |
Returns a WebService token (and private token) for QR login.
string | $qrloginkey | the user key generated and embedded into the QR code for validating the request |
int | $userid | the user the key belongs to |
array | with the tokens and warnings |
|
static |
Returns description of get_tokens_for_qr_login() parameters.
external_function_parameters |
|
static |
Returns description of get_tokens_for_qr_login() result value.
external_description |
|
staticinherited |
Set context restriction for all following subsequent function calls.
stdClass | $context | the context restriction |
|
staticinherited |
This method has to be called before every operation that takes a longer time to finish!
int | $seconds | max expected time the next operation needs |
|
staticinherited |
Makes sure user may execute functions in this context.
stdClass | $context |
|
staticinherited |
Validates submitted function parameters, if anything is incorrect invalid_parameter_exception is thrown.
This is a simple recursive method which is intended to be called from each implementation method of external API.
external_description | $description | description of parameters |
mixed | $params | the actual parameters |
mixed | params with added defaults for optional items, invalid_parameters_exception thrown if any problem found |
|
static |
Check if the given site subscription key is valid.
string | $key | subscriptiion temporary key |
array | with the settings and warnings |
|
static |
Returns description of validate_subscription_key() parameters.
external_function_parameters |
|
static |
Returns description of validate_subscription_key() result value.
external_description |