Description
This function submits a request for a certificate order to the cPanel Market provider.
Examples
https://hostname.example.com:2083/cpsess##########/execute/Market/request_ssl_certificates?access_token=725431a1-d5bc-11e5-a28b-8b0e09a93f05&certificate=%7B%22product_id%22%3A143%2C%22subject_names%22%3A%5B%5B%22dNSName%22%2C%22example.com%22%5D%2C%5B%22dNSName%22%2C%22example.org%22%5D%5D%2C%22vhost_names%22%3A%5B%22example.com%22%5D%2C%22price%22%3A6%7D&certificate=%7B%22product_id%22%3A%22176%22%2C%22subject_names%22%3A%5B%5B%22dNSName%22%2C%22test.example.com%22%5D%5D%2C%22vhost_names%22%3A%5B%22test.example.com%22%5D%2C%22price%22%3A3%7D&provider=cPStore
$cpanel
=
new
CPANEL();
// Connect to cPanel - only do this once.
// Submit certificate orders to the cPanel Market provider.
$submit_order
=
$cpanel
->uapi(
'Market'
,
'request_ssl_certificates'
,
array
(
'access_token'
=>
'725431a1-d5bc-11e5-a28b-8b0e09a93f05'
,
'certificate'
=>
'{"product_id":143,"subject_names":[["dNSName","example.com"],["dNSName","example.org"]],"vhost_names":["example.com","sub.example.com"],"price":6}'
,
'certificate-0'
=>
'{"product_id":"176","subject_names":[["dNSName","test.example.com"]],"vhost_names":["test.example.com"],"price":3}'
,
'provider'
=>
'cPStore'
)
);
my
$cpliveapi
= Cpanel::LiveAPI->new();
# Connect to cPanel - only do this once.
# Submit certificate orders to the cPanel Market provider.
my
$submit_order
=
$cpliveapi
->uapi(
'Market'
,
'request_ssl_certificates'
,
{
'access_token'
=>
'725431a1-d5bc-11e5-a28b-8b0e09a93f05'
,
'certificate'
=>
'{"product_id":143,"subject_names":[["dNSName","example.com"],["dNSName","example.org"]],"vhost_names":["example.com","sub.example.com"],"price":6}'
,
'certificate-0'
=>
'{"product_id":"176","subject_names":[["dNSName","test.example.com"]],"vhost_names":["test.example.com"],"price":3}'
'provider'
=>
'cPStore'
}
);
<!-- Submit certificate orders to the cPanel Market provider. -->
[% execute('Market', 'request_ssl_certificates', { access_token' => '725431a1-d5bc-11e5-a28b-8b0e09a93f05', certificate => '{product_id:666,price:3.5,subject_names:[[dNSName,"arp2wqdpts.test"]]}',provider => 'cPStore' } ) %]
uapi --user=username Market request_ssl_certificates provider=cPStore access_token=725431a1-d5bc-11e5-a28b-8b0e09a93f05 certificate=%7B%22product_id%22%3A%22176%22%2C%22subject_names%22%3A%5B%5B%22dNSName%22%2C%22test.example.com%22%5D%5D%2C%22vhost_names%22%3A%5B%22test.example.com%22%5D%2C%22price%22%3A3%7D%0A |
Notes:
- You must URI-encode values.
- username represents your account-level username.
{
"data":{
"checkout_url":"http://store.example.com/showmethemoney.cgi",
"certificates":[
{
"key_id":"ac90f_639fd_6c236062f0d7a4579a30e01612c4cee0",
"order_item_id":"12345"
},
{
"key_id":"ac90f_639fd_6c236062f0d7a4579a30e01612c4cee1",
"order_item_id":"67890"
}
],
"order_id":"8675309"
},
"errors":undef,
"messages":undef,
"metadata"{
},
"status":1
}
Note:
Use cPanel's API Shell interface (Home >> Advanced >> API Shell) to directly test cPanel API calls.
Parameters
Parameter |
Type |
Description |
Possible values |
Example |
access_token |
string |
Required The access token for the session to the cPanel Market provider. |
A valid access token. |
725431a1-d5bc-11e5-a28b-8b0e09a93f05 |
certificate |
JSON |
Required A JSON-encoded string that contains the details of the certificate. Note: To request multiple certificates, duplicate or increment the parameter name. For example, to request three certificates, use thecertificateparameter multiple times or use thecertificate-1,certificate-2, andcertificate-3parameters. |
A JSON-encoded string that contains the product_id andprice parameters, thesubject_names andvhost_names arrays, and may also contain the subject array. |
Click to view... |
product_id |
string |
Required The product's ID. The certificateJSON-encoded string contains this parameter. |
A valid string. |
666 |
price |
string |
Required The price of the certificate. The certificateJSON-encoded string contains this parameter. |
A valid string that represents the price in US dollars. |
3.5 |
subject_names |
array of arrays |
Required An array that contains arrays that indicate subject names in the certificate. The certificateJSON-encoded string contains this array. |
An array of arrays of subject names. |
|
|
array |
Required An unnamed array that contains a name type and a name. The subject_namesarray contains this array. |
Two elements that consist ofdNSName and a string. Note: This function may support additional name types in later releases. |
"dNSName","5wq5eymnv7.test" |
subject |
array of arrays |
An array that contains arrays with information about the subject of the certificate. The certificateJSON-encoded string contains this array. Note: This array is required for Organization Validation (OV) and Extended Validation (EV).
|
Note: Each array may contain multiple instances of thecountryName,emailAddress,localityName,organizationName,organizationUnitName, orstateOrProvinceNameparameters. The first element in the array is the field, and the second element is the data. The Certificate Authority (CA) should provide a list of required and optional subjectelements. Warning: commonName is prohibited. |
|
countryName |
array |
The certificate subject's country name. The subject array contains this array. |
Two elements that consist ofcountryName and a valid two-letter ISO-3166 country code. |
US |
emailAddress |
array |
The certificate subject's email address. The subject array contains this array. |
Two elements that consist of emailAddress and a string. |
username@example.com |
localityName |
array |
The certificate subject's locality (city) name. The subject array contains this array. |
Two elements that consist of localityName and a string. |
Houston |
organizationName |
array |
The certificate subject's organization name. The subject array contains this array. |
Two elements that consist of organizationName and a string. |
cPanel |
organizationalUnitName |
array |
The certificate subject's organizational unit name. The subject array contains this array. |
Two elements that consist of organizationalUnitNameand a string. |
Documentation |
stateOrProvinceName |
array |
The certificate subject's state or province name. The subject array contains this array. |
Two elements that consist of stateOrProvinceName and a string. |
TX |
vhost_names |
array |
Required A list of names of web virtual hosts (vhosts) for which the system will install the certificate.
|
A comma-separated list of web vhosts. Note: An asterisk character (*) represents every web v=host with which the certificate is compatible. |
"example.com","sub.example.com" "*" |
provider |
string |
Required The cPanel Market provider's name. |
A valid string. |
cPStore |
url_after_checkout |
string |
The URL to send the browser after the user checks out. |
A valid URL that cannot contain a query string. |
http://checkout.example.com |
Returns
Return |
Type |
Description |
Possible values |
Example |
order_id |
integer |
The order ID that the cPanel Market provider assigned. |
A positive integer. |
123456 |
checkout_url |
string |
The URL that the cPanel Market provider uses to process payment. |
A valid publicly-available URL. |
http://store.example.com/showmethemoney.cgi |
certificates |
hash |
Information about each certificate in the order. |
This hash includes the key_id andorder_item_idreturns. |
|
key_id |
string |
The private key's ID. The function returns this value in the certificates hash. |
A valid key ID. |
|
order_item_id |
integer |
The ID of the ordered item. The function returns this value in the certificates hash. |
A positive integer. |
12345 |