laatzen/LaaProductionWeb/LaaProduction.Console/Program.cs
2024-10-10 14:35:22 +02:00

29 lines
1.1 KiB
C#

namespace LaaProduction.Console
{
using System;
using System.Net;
using System.Net.Http;
public class Program
{
const string URL_PATTERN = "https://nodes.sms-esaap.com/keygenproxy/api/v2/keys/devices?orderNumber={0}&radioaddress={1}";
const string X_NODE_TOKEN_HEADER = "X-Node-Token";
const string X_NODE_TOKEN = "d5b8c0b2-81f6-4421-80d0-44eb2093e616";
public static void Main(String[] args)
{
using (var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, String.Format(URL_PATTERN, 3014757, 10309000709)))
{
httpRequestMessage.Headers.Add(X_NODE_TOKEN_HEADER, X_NODE_TOKEN);
ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
using (var httpResponseMessage = new HttpClient().SendAsync(httpRequestMessage).Result)
{
var content = httpResponseMessage?.Content?.ReadAsStringAsync()?.Result?.Trim('"');
}
}
}
}
}