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.
  • 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

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: r6 - 29 Sep 2009 - 17:57:48 - Main.MelanieSeibert
 

Copyright © cPanel 2000-2009.