getRentNumber


URL

http://api-conserver.onlinesim.ru/stubs/handler_api.php?api_key=APIKEY&action=getRentNumber&rent_time=$time&country=$country

Example

  • javascript
    var settings = {
        "async": true,
        "crossDomain": true,
        "url": "https://api-conserver.onlinesim.ru/stubs/handler_api.php?api_key=APIKEY&action=getRentNumber&rent_time=24&country=7",
        "method": "GET",
        "headers": {"accept": "application/json"}
    }
    $.ajax(settings).done(function (response) {
        console.log(response);
    });
  • php
    $curl = curl_init();
    curl_setopt_array($curl, array(
        CURLOPT_URL => "https://api-conserver.onlinesim.ru/stubs/handler_api.php?api_key=APIKEY&action=getRentNumber&rent_time=24&country=7",
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_SSL_VERIFYHOST => false,
        CURLOPT_SSL_VERIFYPEER => false,
        CURLOPT_HTTPHEADER => [
            "Content-Type: application/json",
        ]
    ));
    $response = curl_exec($curl);
    curl_close($curl);
    var_dump(json_decode($response, true));

Order phone number for rent. Phone number should be activated by receiving SMS after order.

Parameters

Parameter name Data type Description Required
country INT code of country available for rent yes
time INT Rent time in hours converted into the day with a rounding-up(e.g. 2h - 1 day, 25h - 2 days) if is missing or equals to 0, then 1 day

Result

After successeful execution you will get the following JSON response:

{
  "status": "success",
  "phone": {
    "id": 1234,
    "endDate": "2021-02-02T13:46:49+03:00",
    "number": "9000000000"
  }
}
Result Description
status method execution status
phone array of phone numbers rent data
phone.id ID of phone number rent
phone.endDate time when the booking of phone number for activation will expire
phone.number quantity of phone numbers available for service

Private method errors

Possible errors in JSON format.

{
  "status": "error",
  "msg": "*error_code*"
}
error_code Description
NO_BALANCE not enough money for the rent of phone number
NO_NUMBERS no phone numbers available or the rent period with no phone numbers available is selected