### Розрахувати замовлення Розрахувати задане замовлення і повернути результат, це використовується в селекторі плану для відображення ціни замовлення.
Список всіх публично доступних методів для взаємодії з API.
GET
Отримати кошик розрахувати -/cart/calculate
Метод запита
GEThttp://apilocal.stableproxy.com/v2/cart/calculate
Параметри запиту
| Ідентифікатор | Правила | Приклад |
|---|---|---|
| traffic-unitНе обов'язково | nullablestringin:gb | "gb" |
| period-unitНе обов'язково | nullablestringin:weeks, weeks, months, years | "weeks" |
| traffic-amount | requiredintegerin:25, 100, 400, 800, 5000 | "25" |
| period-amount | requiredintegerin | "1" |
| countНе обов'язково | nullableinteger | 30 |
| countriesНе обов'язково | nullablearray | {"UA": 10, "PL": 20} |
| type | requiredstringin:shared, private, mobile_rotating_gb, residential_gb, datacenter_gb, residential_city_gb, residential_static_gb, mobile_gb, mobile_static, mobile_static_gb | "shared" |
| currencyНе обов'язково | nullablestringcurrency_code | "USD" |
| has-unlimited-auth-ipsНе обов'язково | nullableex-boolean | false |
| serviceНе обов'язково | nullablestringilluminate\_validation\_rules\_in | 75 |
| ip-scoreНе обов'язково | nullablenumeric | 76 |
Приклади коду
JavaScript
async function getCartCalculate() {
const baseUrl = 'http://apilocal.stableproxy.com/v2';
const req = await fetch(baseUrl + '/cart/calculate?' + Object.entries({
"traffic-unit": "gb",
"period-unit": "weeks",
"traffic-amount": "25",
"period-amount": "1",
"count": 30,
"countries[UA]": 10,
"countries[PL]": 20,
"type": "shared",
"currency": "USD",
"has-unlimited-auth-ips": false,
"service": 75,
"ip-score": 76
}).map(([key, value]) => key + "=" + value).join('&'), {
method: 'GET',
headers: {
'Content-Type': 'application/json'
}
}
);
const res = await req.json();
}