Получить список портов
POST
/ports
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");curl_easy_setopt(hnd, CURLOPT_URL, "https://api.ltesocks.io/v2/ports");
struct curl_slist *headers = NULL;headers = curl_slist_append(headers, "Authorization: Bearer <token>");headers = curl_slist_append(headers, "Content-Type: application/json");curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{ \"plan\": \"O2\", \"countryCode\": \"GB\", \"tags\": [ \"example\" ], \"page\": 1, \"pageSize\": 20 }");
CURLcode ret = curl_easy_perform(hnd);using System.Net.Http.Headers;var client = new HttpClient();var request = new HttpRequestMessage{ Method = HttpMethod.Post, RequestUri = new Uri("https://api.ltesocks.io/v2/ports"), Headers = { { "Authorization", "Bearer <token>" }, }, Content = new StringContent("{ \"plan\": \"O2\", \"countryCode\": \"GB\", \"tags\": [ \"example\" ], \"page\": 1, \"pageSize\": 20 }") { Headers = { ContentType = new MediaTypeHeaderValue("application/json") } }};using (var response = await client.SendAsync(request)){ response.EnsureSuccessStatusCode(); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body);}package main
import ( "fmt" "strings" "net/http" "io")
func main() {
url := "https://api.ltesocks.io/v2/ports"
payload := strings.NewReader("{ \"plan\": \"O2\", \"countryCode\": \"GB\", \"tags\": [ \"example\" ], \"page\": 1, \"pageSize\": 20 }")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>") req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close() body, _ := io.ReadAll(res.Body)
fmt.Println(res) fmt.Println(string(body))
}HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://api.ltesocks.io/v2/ports")) .header("Authorization", "Bearer <token>") .header("Content-Type", "application/json") .method("POST", HttpRequest.BodyPublishers.ofString("{ \"plan\": \"O2\", \"countryCode\": \"GB\", \"tags\": [ \"example\" ], \"page\": 1, \"pageSize\": 20 }")) .build();HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());System.out.println(response.body());OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");RequestBody body = RequestBody.create(mediaType, "{ \"plan\": \"O2\", \"countryCode\": \"GB\", \"tags\": [ \"example\" ], \"page\": 1, \"pageSize\": 20 }");Request request = new Request.Builder() .url("https://api.ltesocks.io/v2/ports") .post(body) .addHeader("Authorization", "Bearer <token>") .addHeader("Content-Type", "application/json") .build();
Response response = client.newCall(request).execute();import axios from 'axios';
const options = { method: 'POST', url: 'https://api.ltesocks.io/v2/ports', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, data: {plan: 'O2', countryCode: 'GB', tags: ['example'], page: 1, pageSize: 20}};
try { const { data } = await axios.request(options); console.log(data);} catch (error) { console.error(error);}const url = 'https://api.ltesocks.io/v2/ports';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"plan":"O2","countryCode":"GB","tags":["example"],"page":1,"pageSize":20}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")val body = RequestBody.create(mediaType, "{ \"plan\": \"O2\", \"countryCode\": \"GB\", \"tags\": [ \"example\" ], \"page\": 1, \"pageSize\": 20 }")val request = Request.Builder() .url("https://api.ltesocks.io/v2/ports") .post(body) .addHeader("Authorization", "Bearer <token>") .addHeader("Content-Type", "application/json") .build()
val response = client.newCall(request).execute()use serde_json::json;use reqwest;
#[tokio::main]pub async fn main() { let url = "https://api.ltesocks.io/v2/ports";
let payload = json!({ "plan": "O2", "countryCode": "GB", "tags": ("example"), "page": 1, "pageSize": 20 });
let mut headers = reqwest::header::HeaderMap::new(); headers.insert("Authorization", "Bearer <token>".parse().unwrap()); headers.insert("Content-Type", "application/json".parse().unwrap());
let client = reqwest::Client::new(); let response = client.post(url) .headers(headers) .json(&payload) .send() .await;
let results = response.unwrap() .json::<serde_json::Value>() .await .unwrap();
dbg!(results);}curl --request POST \ --url https://api.ltesocks.io/v2/ports \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "plan": "O2", "countryCode": "GB", "tags": [ "example" ], "page": 1, "pageSize": 20 }'wget --quiet \ --method POST \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --body-data '{ "plan": "O2", "countryCode": "GB", "tags": [ "example" ], "page": 1, "pageSize": 20 }' \ --output-document \ - https://api.ltesocks.io/v2/portsАвторизация
Заголовок раздела «Авторизация»Тело запросаrequired
Заголовок раздела «Тело запросаrequired»Параметры пагинации
Тип содержимогоapplication/json
object
plan
ID тарифа (точное совпадение)
string
Пример
O2countryCode
string
Пример
GBtags
Array<string>
page
integer
Пример
1pageSize
integer
Пример
20Операция выполнена успешно
Тип содержимогоapplication/json
object
data
Array<object>
object
port
Номер порта
string
ip
Текущий IP-адрес порта (0.0.0.0, если недоступен)
string
geoip
object
continentCode
string
continentName
string
countryCode2
string
countryCode3
string
stateProv
string
district
string
city
string
zipcode
string
latitude
string
longitude
string
isp
string
status
Статус порта
string
currentStatus
Текущий статус
string
resetToken
Токен сброса порта
string
signature
Сигнатура порта
string
vpnAccess
Указывает, имеет ли порт доступ к VPN-серверу
boolean
autoResetInterval
Интервал автосброса порта в секундах; 0 отключает автосброс
integer
tags
Теги порта
Array<string>
plan
object
id
ID тарифа
string
name
Название тарифа
string
countryCode
Код страны тарифа
string
enabled
Указывает, активен ли тариф
boolean
autoRenew
Указывает, включено ли автопродление тарифа
boolean
activatedAt
Время активации тарифа
string формат: date-time
expiresAt
Время окончания тарифа
string формат: date-time
trafficRemains
Оставшийся объём трафика в мегабайтах
integer
tarification
object
time
Срок действия тарифа в секундах
integer
traffic
Объём трафика тарифа в мегабайтах
integer
price
Цена тарифа в центах
integer
credentials
object
ip
Array<string>
password
Array<object>
object
login
string
password
string
page
integer
pageSize
integer
total
integer
Пример
{ "data": [ { "port": 10000, "ip": "1.1.1.1", "geoip": { "continentCode": "NA", "continentName": "North America", "countryCode2": "US", "countryCode3": "United States", "latitude": "38.89037", "longitude": "-77.03196", "isp": "T-Mobile USA, Inc." }, "status": "active", "currentStatus": "active", "resetToken": "6015510d206e4d7b023e5f978a56e3cf49d7e79bc26cf28c69b75314e098a61b", "signature": "Windows", "vpnAccess": true, "plan": { "id": "5349b4ddd2781d08c09890f3", "name": "UK Three", "countryCode": "UK", "enabled": true, "autoRenew": true, "activatedAt": "2022-04-02T05:57:29.054Z", "expiresAt": "2022-05-02T05:57:29.054Z", "trafficRemains": 51200, "tarification": { "time": 2592000, "traffic": 51200, "price": 14500 } }, "credentials": { "ip": [ "2.2.2.2" ], "password": [ { "login": "login", "password": "password" } ] } } ], "page": 1, "pageSize": 20, "total": 7}Ошибка
Тип содержимогоapplication/json
object
error
обязательно
Текст ошибки
string
code
обязательно
Код ошибки
integer
Пример
{ "error": "example error", "code": 400}