Description

This function retrieves a specified set of security questions and answers.

Examples


https://hostname.example.com:2087/cpsess###########/json-api/cpanel?cpanel_jsonapi_user=user&cpanel_jsonapi_apiversion=2&cpanel_jsonapi_module=SourceIPCheck&cpanel_jsonapi_func=loadsecquestions&account=example&q=q1%3A%20What%20was%20your%20high%20school%20mascot%3F&q1answer=Pumas

$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
 
// Load security questions for example.com.
$load_security_questions = $cpanel->api2(
    'SourceIPCheck', 'loadsecquestions',
		{
        'account'       => 'example'
		'q1'			=> 'What was the name of your first pet?'
		'q1answer'		=> 'Snowball2'
		}
    ) 
 );

my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
 
# Load security questions for example.com.
my $load_security_questions = $cpliveapi->api2(
    'SourceIPCheck', 'loadsecquestions',
    { 
		array(        
        'account'       => 'example'
		'q1'			=> 'What was the name of your first pet?'
		'q1answer'		=> 'Snowball2'

    ) 
	 }
 );

cpapi2 --user=username loadsecquestions account=example

{
  "cpanelresult": {
    "apiversion": 2,
    "func": "loadsecquestions",
    "data": [
      {
        "questionnum": "1",
        "question": "What was the name of your first pet?",
        "options": [
          {
            "questionnum": 1,
            "selectedtxt": ""
          },
          {
            "questionnum": 2,
            "selectedtxt": ""
          },
          {
            "questionnum": 3,
            "selectedtxt": ""
          },
          {
            "questionnum": 4,
            "selectedtxt": ""
          },
          {
            "questionnum": 5,
            "selectedtxt": ""
          },
          {
            "questionnum": 6,
            "selectedtxt": ""
          },
          {
            "questionnum": 7,
            "selectedtxt": ""
          }
        ],
        "answer": Snowball2
    ],
    "event": {
      "result": 1
    },
    "module": "SourceIPCheck"
  }
}

Parameters

ParameterTypeDescriptionPossible valuesExample
accountstring

The cPanel account for which to load security questions.

If you do not use this parameter, the function returns the security questions for all of the cPanel accounts on the server.

A valid cPanel account.example
q*string

The security questions.

If you do not use this parameter, the function returns all of the cPanel account's security questions.

Replace * with the security question's number.

A valid string.What was the name of your first pet?
q*answerstring

The security question's answer.

If you do not use this parameter, the function returns all of the cPanel account's security questions' answers.

Replace * with the security question's number.

A valid string.Snowball2

Returns

ReturnTypeDescriptionPossible valuesExample
questionstring

The security question.

Any of the account's security questions. What was the name of your first pet ?
optionsarray of hashes

A array of hashes of information for each possible question.

This function returns seven lists of hashes for each question.

This hash contains the questionnum and selectedtxt returns. 

questionnum

integer

The security question's number.

The function returns this value in the options hash.

Any positive integer.1

selectedtxt

string

The security question's text.

The function returns this value in the options hash.

  • ""
  • The question's text.
""

answer

string

The security question's answer.

This return outputs null unless you specify a value in the q*answer parameter.

The question's answer.Snowball2
reasonstring

A reason for failure.

This function only returns a reason value if there was an error.

A string that describes the error. This is an error message.
resultBoolean

Whether the function succeeded.

  • 1 — The function succeeded.
  • 0 — The function failed.
1