Child pages
  • WHM API 1 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.

Examples


 Raw HTTP Request
POST /cpsess##########/json-api/personalization_get HTTP/1.1
Host: example.com:2087
Cookie: ###################################
Content-Type: application/json
Content-Length: 73
 
{ "api.version": 1, "store": "beverages", "names": [ "coffee",
"milk" ] }
 JSON API


URL
https://hostname.example.com:2087/cpsess##########/json-api/personalization_get
MethodPOST
Content-Typeapplication/json
Request body
{ "api.version": 1, "store": "beverages", "names": [ "coffee", "milk" ] }
 Command Line

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

echo '{"store":"beverages", "names":["coffee","milk"]}' | whmapi1 --input=json --output=json personalization_get
 Output (JSON)
{
	"data": {
		"personalization": {
			"milk": {
				"reason": "OK",
				"value": "cold",
				"success": 1
			},
			"coffee": {
				"value": "hot",
				"success": 1,
				"reason": "OK"
			}
		}
	},
	"metadata": {
		"version": 1,
		"command": "personalization_get",
		"result": 1,
		"reason": "OK"
	}
}

Note:

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


Parameters

Note:

You can only call this function as a JSON request.


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.


                
storestring

A name in which to store the values.

A valid string.

Note:

The parameter's value cannot exceed 128 characters.

donut

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 WHM API 1 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 is not available in the store.

This function returns this value in the key* hash.

  • A valid string.
  • null
hot