cPanel API 2 Functions - SourceIPCheck::loadsecquestions

Warning:

The cPanel API 2 system is deprecated. We strongly recommend that you use UAPI instead of cPanel API 2.

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.
  • You must include the --user=username option.
  • For more information and additional output options, read our Guide to cPanel API 2 documentation or run the cpapi2 --help command.
  • If you run CloudLinux™, you must use the full path of the cpapi2 command:
    /usr/local/cpanel/bin/cpapi2

cPanel Tag System (deprecated)

Warnings:
  • cPanel tags are deprecated . We strongly recommend that you only use the LiveAPI system to call the cPanel APIs. Examples are only present in order to help developers move from the old cPanel tag system to our LiveAPI .
  • cPanel API 2 calls that use cPanel tags vary in code syntax and in their output.
  • For more information, read our Deprecated cPanel Tag Usage documentation.

Output (JSON)

{
    "cpanelresult": {
        "func": "loadsecquestions",
        "data": [{
            "answer": null,
            "questionnum": "1",
            "options": [{
                "selectedtxt": "",
                "questionnum": 1
            }, {
                "questionnum": 2,
                "selectedtxt": ""
            }, {
                "selectedtxt": "",
                "questionnum": 3
            }, {
                "selectedtxt": "",
                "questionnum": 4
            }, {
                "selectedtxt": "",
                "questionnum": 5
            }, {
                "questionnum": 6,
                "selectedtxt": ""
            }, {
                "selectedtxt": "",
                "questionnum": 7
            }],
            "question": "What is your primary frequent flyer number?"
        }, {
            "options": [{
                "selectedtxt": "",
                "questionnum": 8
            }, {
                "selectedtxt": "",
                "questionnum": 9
            }, {
                "selectedtxt": "",
                "questionnum": 10
            }, {
                "questionnum": 11,
                "selectedtxt": ""
            }, {
                "questionnum": 12,
                "selectedtxt": ""
            }, {
                "questionnum": 13,
                "selectedtxt": ""
            }, {
                "questionnum": 14,
                "selectedtxt": ""
            }],
            "answer": null,
            "questionnum": "2",
            "question": "What is your maternal grandfather’s first name?"
        }, {
            "options": [{
                "questionnum": 15,
                "selectedtxt": ""
            }, {
                "selectedtxt": "",
                "questionnum": 16
            }, {
                "questionnum": 17,
                "selectedtxt": ""
            }, {
                "selectedtxt": "",
                "questionnum": 18
            }, {
                "questionnum": 19,
                "selectedtxt": ""
            }, {
                "selectedtxt": "",
                "questionnum": 20
            }, {
                "selectedtxt": "",
                "questionnum": 21
            }],
            "questionnum": "3",
            "answer": null,
            "question": "What is your paternal grandmother’s first name?"
        }, {
            "question": "What is the name of your first employer?",
            "answer": null,
            "questionnum": "4",
            "options": [{
                "selectedtxt": "",
                "questionnum": 22
            }, {
                "questionnum": 23,
                "selectedtxt": ""
            }, {
                "questionnum": 24,
                "selectedtxt": ""
            }, {
                "selectedtxt": "",
                "questionnum": 25
            }, {
                "questionnum": 26,
                "selectedtxt": ""
            }, {
                "questionnum": 27,
                "selectedtxt": ""
            }, {
                "selectedtxt": "",
                "questionnum": 28
            }]
        }],
        "event": {
            "result": 1
        },
        "apiversion": 2,
        "module": "SourceIPCheck"
    }
}
Note:

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


Parameters

Parameter Type Description Possible values Example
account string

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*answer string

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

Return Type Description Possible values Example
question string

The security question.

Any of the account's security questions. What was the name of your first pet?
options array 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
reason string

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.
result Boolean

Whether the function succeeded.

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