opened image

API - Creating a service

When ordering a service on the Zomro platform, it is necessary to follow several important steps: adding the service to the cart, activating a promo code (if available), and directly purchasing the service. These steps allow for effective use of the promo code functionality during the order. To place an order, it is necessary to pass certain parameters of the service, the details of which are presented below.

The process of creating an order consists of the following stages:

  • Adding the service to the cart
  • Activating the promo code
  • Purchasing the service from the cart

Using these specific stages of purchase allows for the use of a promo code during the order.

To create an order, you need to pass the parameters of the service that interest us. How to obtain the available parameters is described here

 

Request structure for placing an order for the Cloud VPS service from Zomro:
 

URL: 

https://api.zomro.com/

Method: POST

Request body (Form-data):
 

ParameterExample valueRequired parameterDescription of the value
funcv2.instances.order.paramYesFunction for ordering the service
auth21fc199...c43f71NoSession token. This is one of the authorization options. More details on other options are described here
outjsonNoIn what format to expect a response from the API
sokokYesConfirmation of the operation
order_period-50YesFor cloudvps services, daily billing is used. To purchase the service, use the value: -50, 1, 3, 6, 12.
-50 - daily billing, 1 - ordering the service for 1 month, 3 - ordering for 3 months, and so on.
licence_agreementonYesCorresponds to the agreement with the license for use
pricelist6740YesID of the tariff to be ordered. The tariff ID can be obtained from the function v2.instances.order.pricelist. More details on how to use it are described here
order_count1YesThe number of services that can be ordered in one request
force_use_new_cartonYesAdding the service to a new billmanager cart
instances_ssh_keys490NoID of the SSH key to be added to the server after the OS installation. Do not pass if the parameter use_ssh_key=off
passwordMypassword1NoAccess password to the server. In the case of Linux - password for the root user. In the case of Windows - password for the Administrator user. Do not pass if the parameter use_ssh_key=on.
Also, the password must contain at least 1 uppercase English letter, 1 numeric character, and a minimum of 8 characters.  
servernameMyServerNoCustom server name
instances_os18d0ee2e-4d57-4f40-9b56-03c1773b5831YesUID of the operating system to be installed. The UID of the operating system can be obtained from the function v2.instances.order.pricelist. More details on how to use it are described here
use_ssh_keyoffNoWhether to use an SSH key or not. Can take values off or on.
addon_xxx

260

NoAdditional parameters of the service. Can be RAM, number of CPUs, disk size, traffic volume, type of IPv4 or IPv6. Available parameters depend on the tariff. To find out which options are available, you can refer to the example described here
datacenter

13

YesDatacenter number. To find out which options are available, you can refer to the example described here
backups_scheduleonNoCreating a backup schedule at the time of creating a backup
backups_schedule_nameMyBackupYes, if the value backups_schedule is usedName of the backup creation schedule
backups_schedule_rotation_days1,2,3,4,5,6,0Yes, if the value backups_schedule is usedOn which days to create backups. The week starts on Sunday, which has ID - 0. Accordingly, Monday has the value 1. The other days of the week have corresponding values.
backups_schedule_rotation_time04:20Yes, if the value backups_schedule is usedAt what time to create a backup

 

 

Example of ordering a service

For example, we will use the Cloud Essential tariff with the Linux Ubuntu 20.04 OS, a server only with IPv6, and using the root user password.

URL: 

https://api.zomro.com/

Method: POST

 

Request body (Form-data):

ParameterValue
funcv2.instances.order.param
auth21fc199...c43f71
outjson
sokok
order_period-50
licence_agreementon
pricelist

6740

order_count1
passwordMyPassword1
servernameMyServer-1
instances_os

479c96f1-ccc6-47a2-952c-c9e3bbdc8d07

use_ssh_keyoff

addon_6746

260

force_use_new_carton
datacenter13

 

Here is an example of a request that can be executed from the console:

curl --location 'https://api.zomro.com/' \
--form 'func="v2.instances.order.param"' \
--form 'auth="211a9ac6309a9f0c340bdebf"' \
--form 'out="json"' \
--form 'sok="ok"' \
--form 'order_period="-50"' \
--form 'licence_agreement="on"' \
--form 'use_ssh_key="off"' \
--form 'pricelist="6740"' \
--form 'servername="MyServer-1"' \
--form 'password="Mypassword1"' \
--form 'instances_os="479c96f1-ccc6-47a2-952c-c9e3bbdc8d07"' \
--form 'order_count="1"' \
--form 'addon_6746="260"' \
--form 'datacenter="13"' \
--form 'force_use_new_cart="on"'

 

After executing the request, we need the data that is located in the following nesting:

doc

 

Here are the values obtained as a result of executing the request:

...,

"lineitem.id": {
    "$": "1818"
},
...

 

 

This value "1818", which is the order number in the cart, is needed for further activation of the service. We will remember it for future use.

 

After executing this request, the existing product can also be seen in the cart.


 

The next step will be to activate the promo code, if one is present. This step is not mandatory, but if the client has a promo code, it would be great to have the opportunity to use it.

URL: 

https://api.zomro.com/

Method: POST

Request body (Form-data):

ParameterExample valueRequired parameterDescription of the value
funccartYesFunction name for working with the cart
auth21fc199...c43f71NoSession token. This is one of the authorization options. More details on other options are described here
outjsonNoIn what format to expect a response from the API
sokokYesConfirmation of the operation
promocodePROMO_2024YesThe promo code that is planned to be used. 
clicked_buttonapply_promocodeYesConfirmation of the promo code activation

 

Here is an example of a request that can be executed from the console:

curl --location 'https://api.zomro.com/' \
--form 'out="json"' \
--form 'auth="46ffb314c8d46ec1f2f1df16"' \
--form 'func="cart"' \
--form 'promocode="PROMO_2024"' \
--form 'sok="ok"' \
--form 'clicked_button="apply_promocode"'

 

After executing this request, the result of the promo code activation can be seen in the cart:

 

 

In the image, it can be seen that the promo code PROMO_2024 has been successfully activated. 
PS: In reality, the promo code PROMO_2024 is not valid in your case; it was created solely for writing this instruction.

The next step will be to activate the service.

In case the promo code does not provide a 100% discount, it is necessary to additionally pay for the service from the personal account. 

Let's consider the situation where the promo code does not cover 100% of the service cost. The API request will look as follows:

 URL: 

https://api.zomro.com/

Method: POST

Request body (Form-data):

ParameterExample valueRequired parameterDescription of the value
funccartorder.create.confirmYesFunction for working with the cart
auth21fc199...c43f71NoSession token. This is one of the authorization options. More details on other options are described here
outjsonNoIn what format to expect a response from the API
sokokYesConfirmation of the operation
elid1818YesOrder ID. This value is obtained when adding the service to the cart
paymethod_id0YesPayment method ID. The value 0 is standard and corresponds to the method of paying for the order from the personal account

 

 

Here is an example of a request that can be executed from the console:

 

curl --location 'https://api.zomro.com/' \
--form 'out="json"' \
--form 'auth="cd63c7832f0ae5947c49ac06"' \
--form 'func="cartorder.create.confirm"' \
--form 'sok="ok"' \
--form 'elid="1818"' \
--form 'paymethod_id="0"'

 

 

After executing this request, the cart for this service should be empty, and in the general list of CloudVPS services, we see our service in the status "Activation in progress":

 

 

During the activation process of the service, there are no additional actions with the service. After the service is activated, we will have a list of available actions to manage the services, such as: Start, Stop, Delete, Resize, and others.
 

We also recommend studying articles that may be useful for interacting with the Cloud VPS products via the API: