Page tree
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.

 

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. 
  • We introduced this functionality in cPanel & WHM version 11.52.0.8.

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