Register Key-Based Authentication — XMLregisterAuth.cgi

This Manage2 function allows you to register your computer to use keyed authentication.

Variables

Input

  • user (string) — Your username.
  • pickup (string) — The pickup passphrase that was added to your account.
  • service (string) — The name of the service using the scripts. This variable helps you distinguish keys from one another.

Output

  • ip (string) — The IP address you have just registered.
  • key (string) — A key you can use to authenticate this IP address.
  • reason (string) — Information about adding the registration.
  • status (integer) — Describes whether the registration was successful.
    • 1 — The registration was successful.
    • 0 — The request failed.
    • -1 — The input was invalid.

Examples

Using HTTP (direct API call)

Show Hide

Calling https://manage2.cpanel.net/XMLregisterAuth.cgi?user=user;pickup=hello+world;service=license-suite-2000 in a web browser will produce XML output similar to the following:

<XMLRegisterAuth
        key="..."
        ip="192.0.32.10"
        reason="Successfully registered license-suite-2000 on 192.0.32.10"
        status="1" />

Calling the function using the URL above will return XML data by default. To change the output format that will be returned, use either of the following URLs:

  • JSONhttp://manage2.cpanel.net/XMLregisterAuth.cgi?output=json&user=user;pickup=hello+world;service=license-suite-2000
  • YAMLhttp://manage2.cpanel.net/XMLregisterAuth.cgi?output=yaml&user=user;pickup=hello+world;service=license-suite-2000
For more information about each of these output types, visit our Choosing an Output Type documentation.

Using a Perl module

Show Hide

The following is an example of a Perl module that will call XMLregisterAuth.cgi. You can use this module to pass input variables to a Manage2 API function.

use cPanelLicensing;
    my $cpl = cPanelLicensing->new();
    $cpl->registerAuth(user => $user, pickup => $pickup, service => $service);

In the example above:

  • $user is the Manage2 user obtaining the authentication key.
  • $pickup is the pickup passphrase that was added to your account.
  • $service is the name of the service using the scripts.

You can learn more about using a Perl module to call API functions.

Using a PHP class

Show Hide

The following is an example showing how to call the cPanelLicensing PHP class. You can use this class to pass input variables to the Manage2 API using a few short calls.

<?php
    include("cpl.inc.php");
    $cpl = new cPanelLicensing();
    $cpl->registerAuth(array(
        "user" => $user,
        "pickup" => $pickup,
        "service" => $service));
    ?>

In the example above:

  • $user is the Manage2 user obtaining the authentication key.
  • $pickup is the pickup passphrase that was added to your account.
  • $service is the name of the service using the scripts.

You can learn more about using a PHP class to call API functions.

Topic revision: r2 - 21 Feb 2013 - 20:05:15 - Main.ColinShannon