Add order

Add an order for any client


Endpoint


Method URI
POST https://apiv2.keliweb.it/api/v2/keliweb/add-order

Request Parameters


Parameter Type Description Required
HTTP headers: Authorization string Bearer + the token to access APIs Required
pid array | integer The array of product ids to add the order for Optional
domain array | string The array of domain names associated with the products/domains Optional
billingcycle array | string The array of billing cycles for the products Optional
domaintype array | string For domain registrations, an array of register or transfer values Optional
regperiod array | integer For domain registrations, the registration periods for the domains in the order Optional
eppcode array | string For domain transfers. The epp codes for the domains being transferred in the order Optional
nameserver1 string The first nameserver to apply to all domains in the order Optional
nameserver2 string The second nameserver to apply to all domains in the order Optional
nameserver3 string The third nameserver to apply to all domains in the order Optional
nameserver4 string The fourth nameserver to apply to all domains in the order Optional
nameserver5 string The fifth nameserver to apply to all domains in the order Optional
customfields array | string An array of base64 encoded serialized array of product custom field values Optional
configoptions array | string An associative array of product configurable options values {configoption.id : option.id} Optional
promocode string The promotion code to apply to the order Optional
affid integer The affiliate id to associate with the order Optional
addons array | string An array of comma separated addons IDs to create on order with the products Optional
hostname array | string The hostname of the server for VPS/Dedicated Server orders Optional
ns1prefix array | string The first nameserver prefix for the VPS/Dedicated server. Eg. ns1 in ns1.hostname.com Optional
ns2prefix array | string The second nameserver prefix for the VPS/Dedicated server. Eg. ns2 in ns2.hostname.com Optional
rootpw array | string The desired root password for the VPS/Dedicated server. Optional
contactid integer The id of the contact, associated with the client, that should apply to all domains in the order Optional
dnsmanagement boolean Add DNS Management to the Domain Order Optional
domainfields array | string An array of base64 encoded serialized array of TLD Specific Field Values Optional
emailforwarding array | boolean Add Email Forwarding to the Domain Order Optional
idprotection array | boolean Add ID Protection to the Domain Order Optional
domainrenewals array A name -> value array of $domainName -> $renewalPeriod renewals to add an order for Optional
addonid integer The Addon ID for an Addon Only Order Optional
serviceid integer The service ID for the addon only order Optional
addonids array | integer An Array of addon ids for an Addon Only Order Optional
serviceids array | integer An array of service ids to associate the addons for an Addon Only order Optional

Response Parameters


Parameter Type Description
result string The result of the operation: success or error
orderid integer The Order ID for the created order
productids string The Product/Service ID(s) created by the order
addonids string The Addon ID(s) created by the order
domainids string The Domain ID(s) created by the order
invoiceid integer The Invoice ID created for the order

Example Request (PHP Curl)

            

                    $curl = curl_init();
                    
                    curl_setopt_array($curl, array(
                      CURLOPT_URL => "https://apiv2.keliweb.it/api/v2/keliweb/add-order",
                      CURLOPT_RETURNTRANSFER => true,
                      CURLOPT_ENCODING => "",
                      CURLOPT_MAXREDIRS => 10,
                      CURLOPT_TIMEOUT => 0,
                      CURLOPT_FOLLOWLOCATION => false,
                      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
                      CURLOPT_CUSTOMREQUEST => "POST",
                      CURLOPT_POSTFIELDS =>
                        http_build_query(
                                array(
                                    'pid'           => array(1,1),
                                    'domain'        => array('domain1.com', 'domain2.com'),
                                    'billingcycle'  => array('monthly','semi-annually'),
                                    'addons'        => array('1,3,9', ''),
                                    'customfields'  => array(base64_encode(serialize(array("1" => "Google"))), base64_encode(serialize(array("1" => "Google")))),
                                    'configoptions' => array("1" => 999),
                                    'domaintype'    => array('register', 'register'),
                                    'regperiod'     => array(1, 2),
                                    'dnsmanagement' => array(0 => false, 1 => true),
                                    'nameserver1'   => 'ns1.demo.com',
                                    'nameserver2'   => 'ns2.demo.com',
                                    'paymentmethod' => 'mailin'
                                )
                            ),
                      CURLOPT_HTTPHEADER => array(
                        "Content-Type: multipart/form-data",
                        "X-Requested-With: XMLHttpRequest",
                        "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NhMmNlNkNjNhMmU2MmUxIzZDRkODY5MS1mMDMzLTQ1MWMtYjU-3EHc",
                      ),
                    ));
                    
                    $response = curl_exec($curl);
                    $err = curl_error($curl);
                    
                    curl_close($curl);
                    
                    if ($err) {
                      echo "cURL Error #:" . $err;
                    } else {
                      echo $response;
                    }

            
        

Example Request (jQuery AJAX)

            
                    var form = new FormData();
                    form.append("pid", "[1,1]");
                    form.append("domain", "['domain1.com', 'domain2.com']");
                    form.append("billingcycle", "['monthly','semi-annually']");
                    form.append("addons", "['1,3,9', '']");
                    form.append("customfields", "["1" : "Google", "1" => "Google"]");
                    form.append("configoptions", "["1" : 999, "1" : 999]");
                    form.append("domaintype", "['register', 'register']");
                    form.append("regperiod", "[1, 2]");
                    form.append("dnsmanagement", "[0 : false, 1 : true]");
                    form.append("nameserver1", "ns1.demo.com");
                    form.append("nameserver2", "ns2.demo.com");
                    form.append("paymentmethod", "mailin");

                    var settings = {
                        "async": true,
                        "crossDomain": true,
                        "url": "https://apiv2.keliweb.it/api/v2/keliweb/add-order",
                        "method": "POST",
                        "headers": {
                            "Authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6ImNjMDEwYWVlYmUzMjMxMmZlZjBiNzRjYTBhMmNlNDc2MjNjNhMMTA1MzJjODk1In0",
                            "cache-control": "no-cache",
                        },
                        "processData": false,
                        "contentType": false,
                        "mimeType": "multipart/form-data",
                        "data": form
                    }

                    $.ajax(settings).done(function (response) {
                        console.log(response);
                    });
            
        

Example Response (JSON payload)

            
                    {
                        "result"    : "success",
                        "orderid"   : "1",
                        "productids": "1,2",
                        "addonids"  : "1,2,3",
                        "domainids" : "1,2",
                        "invoiceid" : "1"
                    }