Description

This function creates an EasyApache 4 profile.

 This function only writes files to the /etc/cpanel/ea4/profiles/custom/ directory.

Examples 




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




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




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



{
   "data":{
      "path":"/etc/cpanel/ea4/profiles/custom/new_profile.json"
   },
   "metadata":{
      "result":1,
      "reason":"OK",
      "version":1,
      "command":"ea4_save_profile"
   }
}




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



Parameters

ParameterTypeDescriptionPossible valuesExample
filenamestring

Required

The profile's file name.

A valid file name.

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.

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.

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.

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.

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