using System.Net.Http.Headers; using System.Net.Http.Json; using System.Text.Json; var identityUrl = Environment.GetEnvironmentVariable("DECISIOQ_IDENTITY_URL") ?? "https://identity.vinquery.com/connect/token"; var dksUrl = Environment.GetEnvironmentVariable("DECISIOQ_DKS_URL") ?? "https://dks.vinquery.com"; var ddeUrl = Environment.GetEnvironmentVariable("DECISIOQ_DDE_URL") ?? "https://dde.vinquery.com"; var audience = Environment.GetEnvironmentVariable("DECISIOQ_AUDIENCE") ?? "vinquery:api:decisioq"; using var http = new HttpClient(); var tokenResponse = await http.PostAsJsonAsync(identityUrl, new { clientId = Environment.GetEnvironmentVariable("DECISIOQ_CLIENT_ID"), clientSecret = Environment.GetEnvironmentVariable("DECISIOQ_CLIENT_SECRET"), audience }); tokenResponse.EnsureSuccessStatusCode(); var tokenJson = await tokenResponse.Content.ReadFromJsonAsync(); var token = tokenJson.GetProperty("jwtToken").GetString(); http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token); await http.GetAsync($"{dksUrl}/decisioncatalog/decisions/AUTO-REPR-070"); var payload = JsonSerializer.Deserialize(await File.ReadAllTextAsync("../auto-repr-070-execute.json")); using var request = new HttpRequestMessage(HttpMethod.Post, $"{ddeUrl}/api/v1/execute-catalog") { Content = JsonContent.Create(payload) }; request.Headers.Add("X-Correlation-Id", "auto-repr-070-demo-001"); var result = await http.SendAsync(request); Console.WriteLine(await result.Content.ReadAsStringAsync());