Methods of payment Abuse

How to work with the BILLmanager API

20.06.2022, 13:26

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

It has its own API, with which you can scale servers on flexible tariffs, receive information about payments, debits from the account. As a rule, any API developer on the site has detailed documentation on installing and configuring the software interface.

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

List of parameters

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

How to get a list of VDS

To get a 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 — a function performed in billing;
out is the data output format, xml, json and jsonData are supported.

In all requests, you need to use your personal data, so we change username:password to your username and password, then we execute 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:

  1. authinfo — authorization data in billing;
  2. func — a function performed in billing;
  3. addon_X — addition to the order (optional), for example, for ordering control panels or IPv6 addresses;
  4. autoprolong — an option that enables or disables automatic server renewal;
  5. ostempl — OS template for ordering;
  6. period — the period of the order, the number of months is indicated, 1, 3, 6, 12 are supported;
  7. pricelist - the ID of the tariff plan;
  8. skipbasket — the flag for skipping the shopping cart stage, for automatic ordering of the service;
  9. domain — domain name of the server (optional);
  10. sok — confirmation of the request.

Changing server settings

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 the parameters of a dedicated server:

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:

  1. authinfo — authorization data in billing;
  2. func — a function performed in billing;
  3. elid code of the service;
  4. addon_X — add-on to change (optional), for example, to change the number of IP addresses;
  5. domain — domain name (optional);
  6. sok — confirmation of the request.

Additions to the tariff plan when ordering or changing services via the API are transmitted via the addon_ parameter, which takes the value addon_5=10, where 5 is the extension code, 10 is the value.

When making API requests, you can use the browser console, on the "network" tab you can see which requests are made from the browser when ordering a server, the same parameters can be transmitted via 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 this without the BILLmanager API. However, in the case of ordering 10, 100 VDS or a massive change in server parameters, this process may take several hours. For such cases, it is customary to use cycles:

#!/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 the server order request API, seq specifies the number of servers to order. The server order parameters are similar to ordering a single server without using cycles.

The full documentation on working with the BILLmanager API from the developer is set out here.