URL
https://onlinesim.ru/api/rent/getRentNum.php?apikey=APIKEY&country=7&days=30
Getting a number
Example
- javascript
var settings = {
"async": true,
"crossDomain": true,
"url": "https://onlinesim.ru/api/rent/getRentNum.php?apikey=APIKEY&country=7&days=30",
"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://onlinesim.ru/api/rent/getRentNum.php?apikey=APIKEY&country=7&days=30",
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));
Options
Parameter Name | Parameter | Data type | Description |
---|---|---|---|
country | required | INT | a country. 7 - Russia, 77 - Kazakhstan, 380 - Ukraine |
days | required | INT | Number of rental days. see tariffsRent |
extension | non-required | BOOLEAN | auto-extend. default - true |
pagination | non-required | BOOLEAN | message pagination, if = false - disabled |
After successful execution, a response will be received in JSON format, as follows:
json {response:1, item => { checked: false,country: 7,days: 0,extend: {1: 30, 7: 210, 15: 450, 30: 900},hours: 0,messages: {current_page: 1, data: [], from: 1, last_page: 1, per_page: 20, to: 0, total: 0},number: "9313358547",reload: 0,rent: 1,status: 0,time: 19,tzid: 3715}}
Result | Description |
---|---|
response | 1, if the request is successful, or an error message |
item | object - rent number |
Parameter | Type | Description |
---|---|---|
checked | bool | number confirmation |
country | int | country, see parameters |
days | int | the number of days left on rent |
extend | object | Possible renewal options: {1: 30, 7: 210, 15: 450, 30: 900} see extendRentState |
hours | int | number of hours remaining on lease |
messages | object | messages see rent Message |
number | str | tefon number |
reload | ? int | port reboot. 0 - reboot is available. [see portReload](# portReload) |
rent | int | total number of days purchased |
status | int | 0 - number in the process of confirmation, 1 - number confirmed |
time | int | number of minutes remaining on lease |
tzid | int | operation id |
The structure of the message object. pagination is needed only to form a list, the request will contain all messages at once. Attention, maybe a limit on the number of messages will be added.
Parameter | Type | Description |
---|---|---|
current_page | int | First page |
data | object in array | paginated message array. [[{code: "sms code",created_at: "2019-12-12 10:50:43",id: 1,service: "service", text: "message"}, ...], [{...}, ...],...] |
from | int | First page |
last_page | int | Number of pages |
per_page | int | Number of posts per page |
to | int | number of pages |
total | int | number of messages |
Результат | Описание |
---|---|
EXCEEDED_CONCURRENT_OPERATIONS | the number of simultaneously ordered rooms for your account has been exceeded |
WARNING_LOW_BALANCE | Not enough funds to buy the service |
NO_NUMBER | for the selected service, free numbers are temporarily absent |
INTERVAL_CONCURRENT_REQUESTS_ERROR | the number of simultaneous requests to issue a number has been exceeded, please try again later |
TRY_AGAIN_LATER | the request temporarily cannot be completed |
DUPLICATE_OPERATION | adding operations with the same parameters |
UNDEFINED_COUNTRY | country specified incorrectly |
UNDEFINED_DAYS | the number of days is incorrect |