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

Edit a Package — editpkg

This function edits all aspects of a specific hosting package.

ALERT! Warning: Editing a package will cause all accounts using that package to be updated to the new values defined in the package.

Calling Functions

Using the XML API

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

  • Append the /xml-api/editpkg 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/editpkg

  • 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 editpkg function from within your custom script:

  • Append the /json-api/editpkg 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/editpkg

  • 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 editpkg function takes the following variables as input.

The following variable is required:

  • name (string) — Name of the package you wish to edit.

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 the account has a dedicated IP.
    • 1 — yes.
    • 0 — no.
  • cgi (boolean) — Whether the account has CGI access.
    • 1 — yes.
    • 0 — no.
  • frontpage (boolean) — Whether 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+.
    • If no value is provided, and the package has an existing theme, then the function will use the existing theme. This behavior only applies to version 11.36+.
  • language (string) — Name of the language to be used for this package by default.
  • 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. This parameter's default value is 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.
  • maxftp (integer) — The number of FTP accounts an account assigned to the package can create. Maximum: 999
  • maxsql (integer) — The number of SQL databases an account assigned to the package can create. Maximum: 999
  • maxpop (integer) — The number of email accounts an account assigned to the package can create. Maximum: 999
  • maxlst (integer) — The number of email lists an account assigned to the package can create. Maximum: 999
  • maxsub (integer) — The number of subdomains an account assigned to the package can create. Maximum: 999
  • maxpark (integer) — The number of parked domains an account assigned to the package can create. Maximum: 999
  • maxaddon (integer) — The number of addon domains an account assigned to the package can create. Maximum: 999
  • hasshell (boolean) — Whether the account has shell access.
    • 1 — yes.
    • 0 — no.
  • bwlimit (integer) — The amount of bandwidth the account can use in a month. Maximum: unlimited

The following variable was introduced in version 11.34:

  • digestauth (boolean) — Whether the account should have digest authentication enabled.
    • 1 — yes.
    • 0 — no.

The following variables were introduced in version 11.40:

  • _PACKAGE_EXTENSIONS (space delimited) — The package extensions that are associated with this package.
    • If one or more package extensions are associated with the package, you can also modify the variables that are associated with the extension. Consult the documentation for your extension for a list of possible variables.
      PICK Remember: The _PACKAGE_EXTENSIONS key, its values, and all associated package extensions variables are case-sensitive.
  • remove_missing_extensions (space delimited) — Removes missing or uninstalled extensions.
    ALERT! Warning: This parameter will remove all of the extensions that you enter from the _PACKAGE_EXTENSIONS parameter in the package file. It will not remove the associated extension variables.

Output

  • editpkg — Root-level XML tag for the output of the editpkg function.
    • result — Container for the result of the package addition function.
      • pkg (string) — Name of the package that was edited.
      • status (boolean) — Whether 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/editpkg?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:

<editpkg>
     <result>
            <pkg>packagename</pkg>
            <status>1</status>
            <statusmsg>Modified the package packagename</statusmsg>
      </result>
</editpkg>

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/editpkg?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:

{
   "result":[
      {
         "status":1,
         "statusmsg":"Modified the package packagename",
         "changepackage":[

         ],
         "pkg":"packagename"
      }
   ]
}

Topic revision: r13 - 07 Oct 2013 - 21:12:00 - Main.SarahHaney