Child pages
  • UAPI Functions - Personalization::set
Skip to end of metadata
Go to start of metadata

Description

This function saves its data to an NVData file on disk. cPanel NVData is a per-account configuration storage mechanism that you can use to maintain persistent cPanel & WHM settings across multiple sessions. This includes custom settings for your own themes and plugins.

Examples


 Raw HTTP Request
POST /cpsess##########/execute/Personalization/set HTTP/1.1
Host: example.com:2083
Cookie: ###################################
Content-Type: application/json
Content-Length: 58
   
{ "personalization": { "coffee": "hot", "milk": "cold" } }
 LiveAPI PHP Class

Note:

This method is not supported at this time. We plan to add support for this method in future released of cPanel & WHM.

 LiveAPI Perl Module

Note:

This method is not supported at this time. We plan to add support for this method in future released of cPanel & WHM.

 cPanel Template Toolkit
<!--  Update NVData data on the server. -->
[% 
    SET results = execute( 'Personalization', 'set', {
        personalization => {
            coffee => 'hot',
            milk =>   'cold',
        }
    }); 
%]

 


Note:

For more information, read our Guide to Template Toolkit documentation. 

 Command Line
echo '{"personalization":{"coffee":"hot", "milk":"cold"}}' | uapi --user=username --input=json --output=json Personalization set

Unable to render {include} The included page could not be found.

 Output (JSON)
{
	"messages": null,
	"metadata": {},
	"errors": null,
	"data": {
		"personalization": {
			"coffee": {
				"success": 1,
				"value": "hot",
				"reason": "OK"
			},
			"milk": {
				"value": "cold",
				"success": 1,
				"reason": "OK"
			}
		}
	},
	"status": 1,
	"warnings": null
}

Note:

cPanel's API Shell interface (WHM >> Home >> Development >> API Shell) does not support this function.

Parameters

ParameterTypeDescriptionPossible valuesExample

personalization

 

hash

Required

The NVData keys and values to update.

 

A hash that contains NVData keys and values.

Notes:

  • The hash's values cannot exceed 2048 characters.

  • If a name that already contains a value is not included in this set, the request will not change the value.


Returns

ReturnTypeDescriptionPossible valuesExample
personalization
hash

The NVData keys and values that the system stored.

A hash that contains the key* hash. 

key*

hash

The saved NVdata information on the server.

Note:

You set this return's name (key*) based on the keys that you provide in the personalization parameter.

This function returns this value in the personalization hash.

A hash that contains the reason, success, and value returns.

reason

string

The message that describes the failure if the success Boolean returns 0.

This function returns this value in the key* hash.

A valid string.OK

success

Boolean

Whether the function successfully saved the value on the server.

This function returns this value in the key* hash.

  • 1 — Successful.
  • 0 — Unsuccessful.
1

value

string/undef

The value stored in the field or undef if the pair does not exist in the store.

This function returns this value in the key* hash.

  • A valid string.
  • null
hot