public async Task SendWithImage(LicensePlatePayload lp) { var payload = System.Text.Json.JsonSerializer.Serialize(lp); var request = new HttpRequestMessage(HttpMethod.Post, $"{_config.LicenseRoot}/lpr/platelocation"); request.Headers.Authorization = new AuthenticationHeaderValue("Basic", _config.ApiKey); request.Content = new StringContent(payload, Encoding.UTF8, "application/json"); }
public static LicensePlateDTO ToDto(this LicensePlatePayload lp) { return(new LicensePlateDTO { LicensePlate = lp.LicensePlate, LicensePlateCaptureTime = lp.LicensePlateCaptureTime, Longitude = lp.Longitude, Latitude = lp.Latitude, ContextImageReference = lp.ContextImageReference }); }
public async Task <string> SendPlate(LicensePlatePayload lp) { var payload = System.Text.Json.JsonSerializer.Serialize(lp.ToDto()); Console.WriteLine(payload); var request = new HttpRequestMessage(HttpMethod.Post, $"{_config.LicenseRoot}/lpr/platelocation"); request.Headers.Authorization = new AuthenticationHeaderValue("Basic", _config.ApiKey); request.Content = new StringContent(payload, Encoding.UTF8, "application/json"); var response = await _client.SendAsync(request); return(response.StatusCode.ToString()); }