Page tree
Skip to end of metadata
Go to start of metadata

 

Description

This function sets the value of a non-volatile environment variable.

Examples 


 JSON API
https://hostname.example.com:2087/cpsess##########/json-api/nvset?key=ThermalDetonator&value=Active
 XML API
https://hostname.example.com:2087/cpsess##########/xml-api/nvset?key=ThermalDetonator&value=Active
 Command Line
whmapi0 nvset key=ThermalDetonator value=Active

Notes:

  • You must URI-encode values.
  • For more information and additional output options, read our Guide to WHM API 0 documentation or run the whmapi0 --help command. 
  • We introduced this functionality in cPanel & WHM version 11.52.0.8.

 Output (JSON)
{
   "result":[
      {
         "status":1,
         "key":"ThermalDetonator:Active"
      }
   ]
}
 Output (XML)
<nvset>
      <result>
            <key>ThermalDetonator:Active</key>
            <status>1</status>
      </result>
</nvset>

   

Parameters

ParameterTypeDescriptionPossible valuesExample
keystring

Required

The variable's name.

A valid string.

ThermalDetonator
valuestring

Required

The variable's value.

A valid string.Active

 

Returns

ReturnTypeDescriptionPossible valuesExample
nvsethash

A hash of the function's results.

This hash includes the key and status parameters. 

key

string

The variable and its value.

The function returns this parameter in the nvset hash.

Two valid strings, separated by a colon (:).ThermalDetonator:Active

status

boolean

Whether the function succeeded.

The function returns this parameter in the nvset hash.

  • 1 — Success.
  • 0 — Failure.
1