Child pages
  • WHM API 1 Functions - ea4_save_profile
Skip to end of metadata
Go to start of metadata

Description

This function creates an EasyApache 4 profile. This function only writes files to the /etc/cpanel/ea4/profiles/custom/ directory.

Important:

In cPanel & WHM version 76 and later, when you disable the WebServer role, the system disables this function. For more information, read our How to Use Server Profiles documentation.

Examples 


 JSON API
https://hostname.example.com:2087/cpsess##########/json-api/ea4_save_profile?api.version=1&version=1.3&desc=This%20is%20my%20new%20profile.&filename=new_profile.json&name=New%20Profile&pkg=ea%3Dapache24&pkg=ea-php-cli&tag=Apache%202.4&tag=PHP%205.6&overwrite=0
 XML API
https://hostname.example.com:2087/cpsess##########/xml-api/ea4_save_profile?api.version=1&version=1.3&desc=This%20is%20my%20new%20profile.&filename=new_profile.json&name=New%20Profile&pkg=ea%3Dapache24&pkg=ea-php-cli&tag=Apache%202.4&tag=PHP%205.6&overwrite=0
 Command Line
whmapi1 ea4_save_profile filename=new_profile.json name=New%20Profile pkg=ea-apache24 desc=This%20is%20my%20new%20profile. version=1.3 tag=Apache%202.4 overwrite=1


Notes:

  • You must URI-encode values.
  • For more information and additional output options, read our Guide to WHM API 1 documentation or run the whmapi1 --help command.
  • If you run CloudLinux™, you must use the full path of the whmapi1 command:

    /usr/local/cpanel/bin/whmapi1

 Output (JSON)
{
   "data":{
      "path":"/etc/cpanel/ea4/profiles/custom/new_profile.json"
   },
   "metadata":{
      "result":1,
      "reason":"OK",
      "version":1,
      "command":"ea4_save_profile"
   }
}
 Output (XML)
<result>
    <data>
        <path>/etc/cpanel/ea4/profiles/custom/new_profile.json</path>
    </data>
    <metadata>
        <result>1</result>
        <reason>OK</reason>
        <version>1</version>
        <command>ea4_save_profile</command>
    </metadata>
</result>


Note:

Use WHM's API Shell interface (WHM >> Home >> Development >> API Shell) to directly test WHM API calls.

Parameters

ParameterTypeDescriptionPossible valuesExample
filenamestring

Required

The profile's file name.

A valid file name.

Note:

This file must use the .json extension.

new_profile.json
namestring

Required

The profile's display name.

A valid profile name.New Profile
pkgstring

Required

The packages that the profile contains.

Note:

You can pass this parameter multiple times.

A valid package name.ea-apache24
descstring

A description of the profile.

This value defaults to a blank string.

A valid string.This is my new profile.
versionstring

The profile's version number.

This value defaults to 0.1.

A valid string.1.3
tagstring

The profile's tags.

This parameter has no default value. The function sets the profile's tag list to an empty list if you do not pass it.

Note:

You can pass this parameter multiple times.

A valid string.Apache 2.4
overwriteBoolean

Whether to overwrite the file, if it exists.

This value defaults to 0.

  • 1 — Overwrite the file.
  • 0 — Do not overwrite the file.
1

Returns

ReturnTypeDescriptionPossible valuesExample
path string

The new profile's path.

Note:

The function only returns this value if it succeeds.

A valid path.

/etc/cpanel/ea4/profiles/custom/new_profile.json
already_existsBoolean

Whether the filename value already exists.

Note:

The function only returns this value if the overwrite value is 0, and the specified filename value already exists.

  • 1 — Exists.
  • 0 — Does not exist.
1