Child pages
  • cPanel API 2 Functions - SourceIPCheck::loadsecquestions

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

 

Description

Excerpt
This function retrieves a specified set of security questions and answers.
Include Page
LIB:_cPanelAPI2NoEquivalent
LIB:_cPanelAPI2NoEquivalent

Panel
bgColor#F2F2F2
borderStylenone

Examples


Panel
bgColor#FFFFFF
borderStylenone
Expand
titleWHM API (JSON)
Code Block
languagetext
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

Include Page
LIB:_CallFromWHMAPILink
LIB:_CallFromWHMAPILink

Expand
titleLiveAPI PHP Class
Code Block
languagephp
linenumberstrue
$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'
		}
    ) 
 );

Include Page
LIB:_LiveAPIPHPLink
LIB:_LiveAPIPHPLink

Expand
titleLiveAPI Perl Module
Code Block
languageperl
linenumberstrue
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'

    ) 
	 }
 );

Include Page
LIB:_LiveAPIPerlLink
LIB:_LiveAPIPerlLink

Expand
titleCommand Line
Code Block
languagebash
cpapi2 --user=username loadsecquestions account=example

Include Page
LIB:_cPanelAPI2CLINote
LIB:_cPanelAPI2CLINote

Expand
titlecPanel Tag System (deprecated)

Include Page
LIB:_cPanelAPI2cPanelTagsWarning
LIB:_cPanelAPI2cPanelTagsWarning

Expand
titleOutput (JSON)
Code Block
languagetext
linenumberstrue
{
  "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"
  }
}

Include Page
LIB:_cPanelAPIShellNote
LIB:_cPanelAPIShellNote

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.

Warning
titleImportant:

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.

Warning
titleImportant:

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
titleNote:

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
titleNote:

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
titleNote:

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