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.
<name> Name of the parameter. Corresponds to parameter name in the configuration Parameter.
<value> Value of the parameter according to defined type and size in the configuration Parameter.


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:
  • APPROVED Test connection has been successfully established.
  • DECLINED Test connection could not be established. Fail reason or error message can be optionally send in the TEXT parameter.
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;
}
CloudBlue, an Ingram Micro business, uses cookies to improve the usability of our site. By continuing to use this site and/or logging in you are accepting the use of these cookies. For more information, visit our Privacy Policy.