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

Examples


 Raw HTTP Request
POST /cpsess##########/json-api/personalization_set HTTP/1.1
Host: example.com:2087
Cookie: ###################################
Content-Type: application/json
Content-Length: 98
 
{ "api.version": 1, "store": "beverages", "personalization": {
"coffee": "hot", "milk": "cold" } }
 JSON API


URL
https://hostname.example.com:2087/cpsess##########/json-api/personalization_set
MethodPOST
Content-Typeapplication/json
Request body
{  "api.version" : 1,  "store" :  "beverages" ,  "personalization" : { 
 "coffee" :  "hot" ,  "milk" :  "cold" } }
 Command Line

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

echo '{"store":"beverages", "personalization":{"coffee":"hot", "milk":"cold"}}' | whmapi1 --input=json --output=json personalization_set
 Output (JSON)
{
	"data": {
		"personalization": {
			"milk": {
				"reason": "OK",
				"success": 1,
				"value": "cold"
			},
			"coffee": {
				"reason": "OK",
				"success": 1,
				"value": "hot"
			}
		}
	},
	"metadata": {
		"version": 1,
		"result": 1,
		"command": "personalization_set",
		"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
personalizationhash

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.


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

This function returns this value in the key* hash.

  • A valid string.
  • null
hot