Child pages
  • cPanel API 1 Functions - Postgres::adduserdb
Skip to end of metadata
Go to start of metadata

 

Description

This function adds a PostgreSQL® database user to a database.

Warning:

cPanel API 1 is deprecated. We strongly recommend that you do not use cPanel API 1. However, no equivalent function exists in our newer APIs.

Examples


 LiveAPI PHP Class
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
$add_postgresuser = $cpanel->api1('Postgres','adduserdb', array('cpusername_dbname','cpusername_dbusername') ); // Call the function.


Note:

For more information, read our Guide to the LiveAPI System.

 LiveAPI Perl Module
my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
my $add_postgresuser = $cpliveapi->api1('Postgres','adduserdb', ['cpusername_dbname','cpusername_dbusername'] ); # Call the function.


Note:

For more information, read our Guide to the LiveAPI System.

 cPanel Tag System (deprecated)


Warning:

In cPanel & WHM version 11.30 and later, cPanel tags are deprecated. We provide this example to help developers move from the old cPanel tag system to our LiveAPI system. We strongly recommend that you only use the LiveAPI system to call the cPanel APIs.

<cpanel Module="Postgres::adduserdb( $FORM('db','user'))">
 Command Line
cpapi1 --user=username Postgres adduserdb cpusername_dbname cpusername_dbusername


Notes:

  • You must URI-encode these values.
  • username represents your account-level username.
  • For more information and additional output options, read our Guide to cPanel API 1 documentation or run the cpapi1 --help command. 
  • We introduced this functionality in cPanel & WHM version 56.

 Output (none)
This function does not return output.

Parameters

ParameterTypeDescriptionPossible valuesExample
dbstring

Required

The database name.

The cPanel account's username, an underscore (_), and the database's name.

Note:

  • The maximum length of the database name is 63 bytes.
  • If the total length of the parameter exceeds the limit for database names, the function will fail.

  • If database prefixing is enabled, this parameter must include the database prefix for the account.
cpusername_dbname
userstring

Required

The database user.

The cPanel account's username, an underscore (_), and the database user's name.

Note:

  • The maximum length of the database username is 63 bytes.
  • If the total length of the parameter exceeds the limit for database usernames, the function will fail.

  • If database prefixing is enabled, this parameter must include the database prefix for the account.
cpusername_dbusername

Returns

This function does not return output.