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

Description

This function retrieves the data from 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/get HTTP/1.1
Host: example.com:2083
Cookie: ###################################
Content-Type: application/json
Content-Length: 33
 
{ "names": [ "coffee", "milk" ] }
 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
<!--  Retrieve the NVData data from the server. -->
[% 
    SET results = execute( 'Personalization', 'get', {
        names => [ 'coffee', 'milk']
    }); 
%]


Note:

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

 Command Line
echo '{"names": ["coffee", "milk"]}' | uapi --user=username --input=json --output=json Personalization get

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

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

Note:

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

Parameters

ParameterTypeDescriptionPossible valuesExample

names

array

Required

A list of NVData keys stored on the server.

A valid array.

Notes:

  • The array's values cannot exceed 2048 characters.
  • If you did not set a value for the requested keys, the system will return null.
                

Returns

ReturnTypeDescriptionPossible valuesExample
personalization
hash

The NVData keys and values stored on the server.

This hash contains the key* hash. 

key*

hash

The retrieved NVData information stored on the server.

Note:

You set this return's name based on the keys that you provide in the personalization parameter with the UAPI Functions - Personalization::set function.

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 retrieved the value from 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