Description

This function creates a non-volatile datastore.

The system creates the datastore in the /home/user/.cpanel/nvdata directory, where user represents the account name. 

We deprecated this function in cPanel & WHM version 74. Instead, we recommend that you use the UAPI Functions - Personalization::set function.


Examples




https://hostname.example.com:2083/cpsess##########/execute/NVData/set?names=testfile1%7Ctestfile2&testfile1=some_data&testfile2=more_data



$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
 // Create the NVData file "testfile1" and "testfile2".
my $set_nvdata = $cpanel->uapi(
    'NVData', 'set', 
    array(
        'names' => 'testfile1|testfile2',
        'testfile1' => 'some_data',
        'testfile2'=> 'more_data'
    ) 
);

 



my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.

# Create the NVData file "testfile1" and "testfile2".
my $set_nvdata = $cpliveapi->uapi(
    'NVData', 'set',
    {
        'names' => 'testfile1|testfile2',
        'testfile1' => 'some_data',
        'testfile2'=> 'more_data'
    }
);

 



<!--  Create the NVData file "testfile1" and "testfile2". -->
[% data = execute( 'NVData', 'set', { names => 'testfile|testfile2', 'testfile1' => 'some_data', 'testfile2' => 'more_data'} ); %]
[% FOREACH q = data %]
     <p>
         [% q %]
     </p>
[% END %]

 



uapi --user=username NVData set names=testfile1%7Ctestfile2 testfile1=some_data testfile2=more_data



{
  "messages": null,
  "errors": null,
  "status": 1,
  "metadata": {
    "transformed": 1
  },
  "data": [
    {
      "set": "testfile1"
    },
    {
      "set": "testfile2"
    }
  ]
}



Parameters

ParameterTypeDescriptionPossible valuesExample

names

 

string

Required

The name of the non-volatile data file that you wish to create.

 

A pipe-separated list of valid filenames to create.

testfile1|testfile2

file

string

Required

The content that you wish to save in the non-volatile data file.

This parameter's name is the name of a file that you listed in the  names  parameter's value.


A valid string.

 

some_data

Returns

ParameterTypeDescriptionPossible valuesExample
 array of hashesAn array of hashes that contains information about the non-volatile data.This array of hashes includes the set return. 

set

string

The name of the non-volatile file that you created.

The function returns this value in the unnamed hash.

A valid file name.

testfile1