Page tree
Skip to end of metadata
Go to start of metadata

 

Description

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

Warning:

We strongly recommend that you use UAPI instead of cPanel API 2. However, no equivalent UAPI function exists.

Examples


 WHM API (JSON)
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

Note:

 For more information, read our Calls from the WHM API documentation.

 LiveAPI PHP Class
$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'
		}
    ) 
 );

Note:

For more information, read our Guide to the LiveAPI System.

 LiveAPI Perl Module
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'

    ) 
	 }
 );

Note:

For more information, read our Guide to the LiveAPI System.

 Command Line
cpapi2 --user=username loadsecquestions account=example

Notes:

  • You must URI-encode values.
  • username represents your account-level username.
  • For more information and additional output options, read our Guide to cPanel API 2 documentation or run the cpapi2 --help command. 
  • We introduced this functionality in cPanel & WHM version 56.

 cPanel Tag System (deprecated)

Warning:

In cPanel & WHM version 11.30 and later, cPanel tags are deprecated. We strongly recommend that you only use the LiveAPI system to call the cPanel APIs.

cPanel API 2 calls that use cPanel tags vary widely in code syntax and in their output. For more information, read our Deprecated cPanel Tag Usage documentation. Examples are only present in order to help developers move from the old cPanel tag system to our LiveAPI.

 Output (JSON)
{
  "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"
  }
}

Note:

Use cPanel's API Shell interface (cPanel >> Home >> Advanced >> API Shell) to directly test cPanel API calls.

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.

Important:

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.

Important:

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.

Note:

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.

Note:

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

The question's answer.Snowball2
reasonstring

A reason for failure.

Note:

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