Оновити налаштування
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");curl_easy_setopt(hnd, CURLOPT_URL, "https://api.ltesocks.io/v2/user/preferences");
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, "{ \"vpnServer\": \"vpn1.ltesocks.io\", \"proxyServer\": \"ap1.ltesocks.io\", \"proxyProtocol\": \"http\" }");
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/user/preferences"), Headers = { { "Authorization", "Bearer <token>" }, }, Content = new StringContent("{ \"vpnServer\": \"vpn1.ltesocks.io\", \"proxyServer\": \"ap1.ltesocks.io\", \"proxyProtocol\": \"http\" }") { 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/user/preferences"
payload := strings.NewReader("{ \"vpnServer\": \"vpn1.ltesocks.io\", \"proxyServer\": \"ap1.ltesocks.io\", \"proxyProtocol\": \"http\" }")
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/user/preferences")) .header("Authorization", "Bearer <token>") .header("Content-Type", "application/json") .method("POST", HttpRequest.BodyPublishers.ofString("{ \"vpnServer\": \"vpn1.ltesocks.io\", \"proxyServer\": \"ap1.ltesocks.io\", \"proxyProtocol\": \"http\" }")) .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, "{ \"vpnServer\": \"vpn1.ltesocks.io\", \"proxyServer\": \"ap1.ltesocks.io\", \"proxyProtocol\": \"http\" }");Request request = new Request.Builder() .url("https://api.ltesocks.io/v2/user/preferences") .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/user/preferences', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, data: { vpnServer: 'vpn1.ltesocks.io', proxyServer: 'ap1.ltesocks.io', proxyProtocol: 'http' }};
try { const { data } = await axios.request(options); console.log(data);} catch (error) { console.error(error);}const url = 'https://api.ltesocks.io/v2/user/preferences';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"vpnServer":"vpn1.ltesocks.io","proxyServer":"ap1.ltesocks.io","proxyProtocol":"http"}'};
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, "{ \"vpnServer\": \"vpn1.ltesocks.io\", \"proxyServer\": \"ap1.ltesocks.io\", \"proxyProtocol\": \"http\" }")val request = Request.Builder() .url("https://api.ltesocks.io/v2/user/preferences") .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/user/preferences";
let payload = json!({ "vpnServer": "vpn1.ltesocks.io", "proxyServer": "ap1.ltesocks.io", "proxyProtocol": "http" });
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/user/preferences \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "vpnServer": "vpn1.ltesocks.io", "proxyServer": "ap1.ltesocks.io", "proxyProtocol": "http" }'wget --quiet \ --method POST \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --body-data '{ "vpnServer": "vpn1.ltesocks.io", "proxyServer": "ap1.ltesocks.io", "proxyProtocol": "http" }' \ --output-document \ - https://api.ltesocks.io/v2/user/preferencesАвторизація
Section titled “Авторизація”Параметри
Section titled “Параметри”Параметри заголовків
Section titled “Параметри заголовків”Необов’язковий UUID, що ідентифікує один запит на зміну. Використовуйте його повторно лише для повторної спроби того самого запиту.
Тіло запитуrequired
Section titled “Тіло запитуrequired”Об’єкт налаштувань користувача
object
Ім’я сервера за замовчуванням для підключення через OpenVPN
Приклад
vpn1.ltesocks.ioІм’я сервера за замовчуванням для підключення через проксі
Приклад
ap1.ltesocks.ioПротокол проксі за замовчуванням
Приклад
socks5Відповіді
Section titled “Відповіді”Операцію виконано успішно
object
Логін користувача
Адреса електронної пошти користувача
Баланс користувача в центах (100$ = 10000)
Загальна кількість портів
Максимальна допустима кількість портів
Знижка користувача у відсотках
object
Пароль residential-проксі поточного клієнта; null, якщо недоступний.
Залишок трафіку residential-проксі в байтах.
object
Ім’я сервера за замовчуванням для підключення через OpenVPN
Ім’я сервера за замовчуванням для підключення через проксі
Протокол проксі за замовчуванням
Приклад
{ "login": "user", "email": "user@example.com", "balance": 10000, "portsCount": 3, "portsLimit": 10, "discountPercent": 10, "residentialProxy": { "availableData": 1073741824 }, "preferences": { "vpnServer": "vpn1.ltesocks.io", "proxyServer": "ap1.ltesocks.io", "proxyProtocol": "http" }}Помилка
object
Текст помилки
Код помилки
Приклад
{ "error": "example error", "code": 400}