Methods of payment Abuse

How to work with BILLmanager API

20.06.2022, 13:26

API is a program interface that allows you to control any application through a set of commands and functions. For example, there is the Yandex Music API, thanks to which you can listen to music on the site. In our work, we use BILLmanager billing.

It has its own API, with the help of which you can scale servers at flexible tariffs, get information about payments and account debits. As a rule, any API developer has detailed documentation on its website on how to install and customize the program interface.

However, the BILLmanager API documentation is difficult to master. If you want to become a professional in working with the API, then it is time to start studying the documentation. If the main thing for you is to complete the task and get the result in a short period of time, it is enough to use the instructions below.

List of parameters

One of the first questions that arise when working with the BILLmanager API is where to get the list of parameters? All parameters for working with BILLmanager can be found in the documentation from the developer. The full list of working parameters can be found by following this link.

How to get the list of VDS

To get the list of VDS, you need to make a request to the following URL:

https://bill.pq.hosting/billmgr?func=vds&authinfo=username:password&out=JSONdata

Parameters in the request:

  • authinfo - authorization data in billing;
  • func - function executed in billing;
  • out - data output format, xml, json and JSONdata are supported.

In all requests you need to use your personal data, so change username:password to your login and password, then make a GET request, for example, using CURL.

How to order VDS

To order a VDS, you need to make a request to the following URL:

https://bill.pq.hosting/billmgr?func=vds.order.param&authinfo=username:password&addon_10=6&addon_11=256&addon_12=500
&addon_13=1&addon_14=28&addon_15=0&addon_28=1&addon_7=5000&addon_9=5&autoprolong=1
&ostempl=ISPsystem%5F%5FCentOS%2D7%2Damd64&period=1&pricelist=6&skipbasket=on&domain=vds.test&sok=ok

Parameters in the request:

  • authinfo - authorization data in billing;
  • func - function to be executed in billing;
  • addon_X -addon to order (optional), for example, to order control panel or IPv6 addresses;
  • autoprolong - option to enable or disable automatic server renewal;
  • ostempl - OS template for the order;
  • period - order period, the number of months is specified, 1, 3, 6, 12 are supported;
  • pricelist - tariff plan ID;
  • skipbasket - flag of skipping the stage of cart checkout, for automatic ordering of the service;
  • domain -domain name of the server (optional);
  • sok - request confirmation.

Changing server parameters

API for changing virtual server parameters:

https://bill.pq.hosting/billmgr?func=vds.edit&authinfo=username:password&addon_11=512&elid=958&domain=company.com&sok=ok

To change dedicated server parameters:

https://bill.pq.hosting/billmgr?func=dedic.edit&authinfo=username:password&addon_26=10&addon_26=10&addon_28=5000&elid=1065&sok=ok

Parameters in the request:

  • authinfo - authorization data in billing;
  • func - function executed in billing;
  • elid - service code;
  • addon_X -addon to change (optional), for example, to change the number of IP addresses;
  • domain - domain name (optional);
  • sok - request confirmation.

Additions to the tariff plan when ordering or changing a service via API are passed through the addon_ parameter, which takes the value addon_5=10, where 5 is the code of the addition, 10 is the value.

When making API requests you can use the browser console, on the "network" tab you can see what requests are made from the browser when ordering a server, the same parameters can be passed through API requests. The list above describes examples of API requests, with an incomplete list of functions and parameters.

Working with cycles

If you need to remove VDS, add memory or processor cores, you can do it without BILLmanager API. However, in case of ordering 10, 100 VDS or mass change of server parameters, this process can take several hours. It is customary to use cycles for such cases:

#!/bin/bash
seq 1 32 | while read line; do
  curl -s -k "https://bill.pq.hosting/billmgr?func=vds.order.param&authinfo=username:password&addon_10=6&addon_11=256&addon_12=500
&addon_13=1&addon_14=28&addon_15=0&addon_28=1&addon_7=5000&addon_9=5&autoprolong=1
&ostempl=ISPsystem%5F%5FCentOS%2D7%2Damd64&period=1&pricelist=6&skipbasket=on&domain=vds.test$line&sok=ok"
done

The example uses API server order request, the seq specifies the number of servers to order. Server ordering parameters are similar to ordering a single server without using loops.

Full documentation on working with the BILLmanager API from the developer is available here.