// Входные данные
$url = "https://data.tronk.info/avgcarprice.ashx";
$date_from = new DateTime("1970-1-1");
$date_to = new DateTime("1970-1-2");
$request_params = array(
"key" => "867983b5-d66d-44d7-b440-5bd00b0b8203",
"marka" => "MARK",
"model" => "model",
"year" => 1900,
"gen" => "C3 (1982—1988)",
"volume" => 1.8,
"horse" => 75,
"kpp" => 1,
"regionid" => 2
);
$get_params = http_build_query($request_params);
// Запрос к серверу
$response = file_get_contents($url."?".$get_params);
// Преобразование ответа
$result = json_decode($response);
import datetime
url = "https://data.tronk.info/avgcarprice.ashx"
# входные данные
params = {
"key": "867983b5-d66d-44d7-b440-5bd00b0b8203",
"marka": "MARK",
"model": "Model",
"year": 1900,
# Необязательные
"gen" => "C3 (1982—1988)"
"volume": 1.8,
"horse" => 75,
"kpp" => 1,
"regionid" => 2
}
# отправка запроса
response = requests.post(
url=url,
params=params,
)
# преобразование ответа к словарю
data = response.json()
using Newtonsoft.Json;
class Program
{
static async Task Main(string[] args)
{
string end_point = "https://data.tronk.info/avgcarprice.ashx";
Dictionary dict_params = new()
{
{ "key", "867983b5-d66d-44d7-b440-5bd00b0b8203" },
{ "marks", "MARK" },
{ "model", "Model" },
{ "year", "1900" },
// Необязательные
{ "gen", "C3 (1982—1988)"},
{ "volume", "1.8" },
{ "horse", "75"},
{"kpp", "1"},
{"regionid", "2"}
};
string url_params = string.Join("&", dict_params.Select(kvp => $"{kvp.Key}={kvp.Value}"));
string url = $"{end_point}?{url_params}";
HttpClient client = new();
string response_body = await client.GetAsync(url).Result.Content.ReadAsStringAsync();
var result = JsonConvert.DeserializeObject(response_body);
}
}