ValidateConfig
Purpose
Use this function to validate plugin configuration.
Mandatory
Yes
Input Parameters
An associative array that contains the plugin configuration data.
Parameter name | Description | Type |
---|---|---|
config
|
An associative array that contains configuration data. | array[ ParameterData ] |
ParameterData
Parameter name | Available values | Description | Type |
---|---|---|---|
<name> |
<value>
|
Parameter value. |
|
Response
An associative array that contains the following keys:
Parameter name |
Description |
Type |
---|---|---|
STATUS
|
Status of method execution. Valid values for the ValidateConfig method are:
|
string
|
TEXT
|
(optional) Additional text description of the operation. | string
|
Example
Input data (request):
Copy
{
"config": {
"username": "example_user",
"password": "example_password" }
}
function Example_ValidateConfig($params)
{
$result = array();
if (!isset($params['config']['username'])) {
$result['STATUS'] = 'DECLINED';
$result['TEXT'] = 'Username is required';
return $result;
}
if (!isset($params['config']['password'])) {
$result['STATUS'] = 'DECLINED';
$result['TEXT'] = 'Password is required';
return $result;
}
$result['STATUS'] = 'APPROVED';
return $result;
}