# Service management via API

### Order a service <a href="#servicemanagementviaapi-orderaservice" id="servicemanagementviaapi-orderaservice"></a>

***

v2.{ITEMTYPE}.order.param - order function

where {ITEMTYPE} - internal name of product type

API functions:

* **v2.vhost.order.param** — order a shared hosting service;
* **v2.vds.order.param** —  order  aVPS;
* **v2.dedic.order.param** — order a dedicated server.

Mandatory parameters:

* **authinfo** or **auth** — [authorization data](https://doc.ispsystem.com/index.php/Working_with_ISPsystem's_API)  in a control panel;
* **pricelist** — tariff id;
* **datacenter** — data center id;
* **order\_period** — order period. Possible values: an integer which equals the number of months. For example, service order for 1 month — period=1, half-a-year — period=6, 1 year — period=12, etc;
* **sok** — order is confirmed.

Additional parameters:

* **domain** — service domain name. if this parameter is not specified, BILLmanager will set a random value;&#x20;
* **skipbasket** — the  skipbasket=on  parameter indicates that the service renewal won't be added into the Cart, but the system will charge the client.
* **autoprolong** — auto-renewal period. Possible values: an integer which equals the number of months;
* **ostempl** — operating system template for a dedicated server or VPS;
* **recipe** —  the system will execute the recipe on a dedicated server or VPS after operating system setup;
* **remoteid** — unique identifier of the service on the side of the reselling billing platform.

Tariff add-ons are passed via the **addon\_  parameter**. Possible value: addon\_5=10, where 5 — add-on id, 10 — value. You can find the add-on id in **Tariff plans** → **Configuration** → id field. You can activate the filed in the table settings form.

The example of an API call for a **shared hosting** order:&#x20;

```
https://billing.sclad.us/?authinfo=username:password&func=v2.vhost.order.param&autoprolong=1&datacenter=1&domain=domain.name&order_period=1&pricelist=2&skipbasket=on&addon_5=10&sok=ok
```

The example of an API call for a **VPS** order:

```xml
https://billing.sclad.us/?authinfo=username:password&func=v2.vds.order.param&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&order_period=1&pricelist=6&skipbasket=on&domain=vds.test&sok=ok 
```

The example of an API call for a **dedicated** **server** order:

```xml
https://billing.sclad.us/?authinfo=username:password&func=v2.dedic.order.param&order_period=1&pricelist=32&datacenter=1&domain=domain.name&addon_33=1&addon_35=1&sok=ok
```

The Dragon interface theme basket is different from the Orion basket. To have orders added to the Dragon shopping cart via the API, pass the ISP-Client:Web-interface header and add the theme=dragon parameter.

```
curl -H "ISP-Client: Web-interface" -F 'func=v2.vds.order.param' -F 'order_period=1' -F 'pricelist=1' -F 'sok=ok' -F 'licence_agreement=on' -F 'theme=dragon' -F 'authinfo=login:password' -k https://billing.sclad.us/billmgr
```

```
https://billing.sclad.us/billmgr?func=v2.vhost.order.param&period=1&pricelist=2&sok=ok&licence_agreement=on&clicked_button=finish&theme=dragon&ISP-Client:Web-interface
```

Copy

### Service renewal <a href="#servicemanagementviaapi-servicerenewal" id="servicemanagementviaapi-servicerenewal"></a>

***

#### Extension services <a href="#servicemanagementviaapi-extensionservices" id="servicemanagementviaapi-extensionservices"></a>

The service renewal function:

* **service.prolong**

Mandatory parameter

* **authinfo** or **auth** — [authorization data](https://doc.ispsystem.com/index.php/Working_with_ISPsystem's_API) in a control panel;
* **elid** — service id;
* **period** — order period. Possible values: an integer which equals the number of months. For example, service order for 1 month — period=1, half-a-year — period=6, 1 year — period=12, etc;&#x20;
* **sok** — operation confirmation.

Optional parameters:

* **skipbasket** — the  ''skipbasket=on'' parameter indicates that the system won't add the service renewal order into the Cart, but will charge the client.

The example of API call for a service renewal:

```xml
https://billing.sclad.us/?authinfo=username:password&func=service.prolong&period=1&elid=958&skipbasket=on&sok=ok
```

#### Auto-renew services <a href="#servicemanagementviaapi-auto-renewservices" id="servicemanagementviaapi-auto-renewservices"></a>

API function:

* **vds.edit** — change the parameters of the virtual server;
* **dedic.edit** — change dedicated server parameters;
* **vhost.edit** — change virtual hosting parameters;
* **soft.edit** — change license parameters;
* **platform.edit** — change platform parameters, etc.

Parameters:

* **autoprolong** — parameter for autoprolong, specify period;
* **elid** — unique identifier (service id).

Parameter **autoprolong** is responsible for **autoprolong**.

Its possible values are:

* **autoprolong=X** — when ordering a license, autoprolong will be set for X months;
* **autoprolong=12** — autoprolong for a year;
* **autoprolong=null** — no autoprolonging.

A different function is used for each product type. In the example we have set the autoprolong for a month for the product type **Licenses** (**soft.edit** function). For auto-renewal of other product types you need to use appropriate function:

Example of a request for auto-renewal of the service for a month

```
https://billing.sclad.us/billmgr?func=soft.edit&autoprolong=1&elid=777&sok=ok
```

#### Output the list of client services <a href="#servicemanagementviaapi-outputthelistofclientservices" id="servicemanagementviaapi-outputthelistofclientservices"></a>

***

#### List of active services <a href="#servicemanagementviaapi-listofactiveservices" id="servicemanagementviaapi-listofactiveservices"></a>

API functions:

* **vds** — virtual server;
* **dedic** — dedicated server;
* **vhost** — virtual hosting;
* **soft** — licenses;
* **platform** — platform, etc.

Parameters:

* filter=on — setting filter by specified parameters
* out=\<format> — output format
* status=2 — output only active services
* account — client's name. It is necessary to add all text from the Name field. The query will not work correctly if the data do not correspond to the ones, specified in the field. For example, value "account=Primerovich (<example@example.ru>)".

Information about active services by product type for the selected client.

Example API call to display active dedicated client servers

```
https://billing.sclad.us/billmgr?func=dedic&filter=on&account=<name>&out=json&status=2
```

The query will not work correctly if the data does not match the ones specified in the field. For example, the value "account=Primerovich (<example@example.ru>)".

#### List of services by product type <a href="#servicemanagementviaapi-listofservicesbyproducttype" id="servicemanagementviaapi-listofservicesbyproducttype"></a>

API function:

* **vds** — virtual server;
* **dedic** — dedicated server;
* **vhost** — virtual hosting;
* **soft** — licenses;
* **platform** — platform, etc.

Parameters:

* out=\<format> — output format

Information about services by product type for the selected client.

```
https://billing.sclad.us/billmgr?func=dedic&clickstat=yes&out=xml
```

### Edit service parameters <a href="#servicemanagementviaapi-editserviceparameters" id="servicemanagementviaapi-editserviceparameters"></a>

***

API functions:

* **vhost.edit** — edit shared hosting parameters;
* **vds.edit** — edit VPS parameters;
* **dedic.edit** — edit dedicated server parameters.

Mandatory parameters:

* **authinfo** or **auth** — [authorization data](https://doc.ispsystem.com/index.php/Working_with_ISPsystem's_API) in a control panel;
* **elid** — service id;
* **sok** — operation confirmation

Optional parameters :

* **addon\_** — tariff add-on that should be edited, for example, addon\_11=512, where 11 — add-on id, 512 — value. You can find the add-on id in **Tariff plans** → **Configuration** → id field. You can activate the filed in the table settings form;
* **autoprolong** — auto-renewal period. Possible values: an integer which equals the number of months;
* **skipbasket** — the *skipbasket=on* parameter indicates that the add-on won't be added into the Cart, but the system will charge the client.

More parameters are available in the **Admin** panel:

* **domain** — service domain name;
* **ip** — service IP address;
* **username** — username in a control panel (e.g. in VMmanager);
* **userpassword** — user password in a control panel (e.g. in VMmanager);
* **serverid** — server name in a control panel (e.g. in VMmanager);
* **ostempl** — OS template for a VPS or dedicated server;
* **recipe** — pre-installed software (recipe) for a VPS or dedicated server;

The example of API call to modify parameters of a  shared hosting service :

```xml
https://billing.sclad.us/?authinfo=username:password&func=vhost.edit&addon_34=1024&elid=945&skipbasket=on&sok=ok
```

The example of API call to modify parameters of a **virtual private server**:

```xml
https://billing.sclad.us/?authinfo=username:password&func=vds.edit&addon_11=512&elid=958&skipbasket=on&sok=ok
```

The example of API call to modify the domain name, IP address, and user credentials in a control panel for a  **VPS**:

```xml
https://billing.sclad.us/?authinfo=admin:password&func=vds.edit&username=user134&userpassword=jYh4nsqe&domain=company.com&ip=8.8.8.8&elid=958&skipbasket=on&sok=ok
```

The example of API call to modify parameters of a dedicated server:

```xml
https://billing.sclad.us/?authinfo=username:password&func=dedic.edit&addon_26=10&addon_26=10&addon_28=5000&elid=1065&skipbasket=on&sok=ok
```
