Software Development Kit

cPanel & WHM's API [+] cPanel & WHM's API [-]


Modules and Plugins [+] Modules and Plugins [-]


cPanel & WHM Hooks [+] cPanel & WHM Hooks [-]


cPAddons (Site Software) [+] cPAddons (Site Software) [-]


System Administration [+] System Administration [-]


Developer Software [+] Developer Software [-]


Back to All Documentation



integrationblogcta.jpg

Add a Package — addpkg

This function adds a new hosting package.

Calling Functions

Using the XML API

To use the XML API to perform the addpkg function from within your custom script:

  • Append the /xml-api/addpkg function call name, plus the required variables (see below), to a URL which includes the address of your server.

  • For example, on a server whose hostname is example.com, you would include the following string in your script: https://example.com:2087/xml-api/addpkg

  • You need to be logged in with the proper permissions in order to call a function. See our document about Authenticating API Function Calls for more information about authenticating APIs from within a script.

  • You can also perform the function by entering the string in your web browser's address bar. This may be useful for testing the function call and viewing its output.

Using the JSON API

To use the JSON API to perform the addpkg function from within your custom script:

  • Append the /json-api/addpkg function call name, plus the required variables (see below), to a URL which includes the address of your server.

  • For example, on a server whose hostname is example.com, you would include the following string in your script: https://example.com:2087/json-api/addpkg

  • You need to be logged in with the proper permissions in order to call a function. See our document about Authenticating API Function Calls for more information about authenticating APIs from within a script.

  • You can also perform the function by entering the string in your web browser's address bar. This may be useful for testing the function call and viewing its output.

Variables

Input

The addpkg function takes the following variables as input.

The following variable is required:

  • name (string) — Name of the package.

The following variables are optional:

  • featurelist (string) — Name of the feature list to be used for the package.
  • quota (integer) — Disk space quota for the package (in Megabytes). Maximum: unlimited
  • ip (boolean) — Whether or not the account has a dedicated IP.
    • 1 — yes.
    • 0 — no.
  • cgi (boolean) — Whether or not the account has CGI access.
    • 1 — yes.
    • 0 — no.
  • frontpage (boolean) — Whether or not the account can install FrontPage extensions.
    • 1 — yes.
    • 0 — no.
  • cpmod (string) — The default theme for the package.
    • If no value is provided, the function will use the cPanel default theme (set in WHM in the Basic cPanel & WHM Setup screen). This behavior only applies to version 11.36+.
  • language (string) — Name of the language to be used for this package by default.
  • maxftp (integer) — The number of FTP accounts a user assigned to the package can create. Maximum: 999
  • maxsql (integer) — The number of SQL databases a user assigned to the package can create. Maximum: 999
  • maxpop (integer) — The number of email accounts a user assigned to the package can create. Maximum: 999
  • maxlists (integer) — The number of email lists a user assigned to the package can create. Maximum: 999
  • maxsub (integer) — The number of subdomains a user assigned to the package can create. Maximum: 999
  • maxpark (integer) — The number of parked domains a user assigned to the package can create. Maximum: 999
  • maxaddon (integer) — The number of addon domains a user assigned to the package can create. Maximum: 999
  • hasshell (boolean) — Whether or not the account has shell access.
    • 1 — yes.
    • 0 — no.
  • bwlimit (integer) — The amount of bandwidth the account can use in a month. Maximum: unlimited
  • MAX_EMAIL_PER_HOUR (integer) — The maximum number of emails the account can send in an hour. This parameter's default value is unlimited. Entering 0 here will result in an unlimited value. This variable is only accepted in version 11.32+.
  • MAX_DEFER_FAIL_PERCENTAGE (integer) — The percentage of failed or deferred email messages the account can send per hour before outgoing mail is rate-limited. The system only applies this value after the MIN_DEFER_FAIL_TO_TRIGGER_PROTECTION value is met. This parameter's default value is unlimited. This variable is only accepted in version 11.32+.
  • MIN_DEFER_FAIL_TO_TRIGGER_PROTECTION (integer) — The minimum number of failed or deferred email messages the account can send before outgoing mail is subject to rate-limiting (according to the percentage set by the MAX_DEFER_FAIL_PERCENTAGE value). This parameter's default value is unlimited. This variable is only accepted in version 11.32+.
  • digestauth (boolean) — Whether or not the account should have digest authentication enabled. This variable is only accepted in version 11.34+.
    • 1 — yes.
    • 0 — no.

Output

  • addpkg — Root-level XML tag for the output of the addpkg function.
    • result — Result of the package addition function.
      • pkg (string) — Name of the package.
      • status (boolean) — Whether or not the operation was successful.
        • 1 — yes.
        • 0 — no.
      • statusmsg (string) — Message about the result of the operation.

Examples

XML API

note Note: Submit the entire request as a single string. For display purposes, the example below may be wrapped.

Calling https://example.com:2087/xml-api/addpkg?name=packagename&featurelist=Default&quota=0&ip=1&cgi=1&frontpage=1&cpmod=x3 &maxftp=9&maxsql=99&maxpop=999&maxlst=999&maxsub=888&maxpark=88&maxaddon=888 &hasshell=1&bwlimit=9999 in WebHost Manager will produce output similar to the following:

<addpkg>
     <result>
            <pkg>packagename</pkg>
            <status>1</status>
            <statusmsg>Created the package packagename</statusmsg>
      </result>
</addpkg>

This will add the package packagename, with the settings listed in the call.

JSON API

note Note: Submit the entire request as a single string. For display purposes, the example below may be wrapped.

Calling https://example.com:2087/json-api/addpkg?name=package1&featurelist=Default&quota=0&ip=1&cgi=1&frontpage=1&cpmod=x3 &maxftp=9&maxsql=99&maxpop=999&maxlst=999&maxsub=888&maxpark=88&maxaddon=888 &hasshell=1&bwlimit=9999 in WebHost Manager will produce output similar to the following:

{
   "result":[
      {
         "status":1,
         "statusmsg":"Created the package package1",
         "pkg":"package1"
      }
   ]
}

This will add the package package1, with the settings listed in the call.

Topic revision: r11 - 24 Jan 2013 - 22:25:27 - Main.JenniferDoubrava