side-area-logo
View Categories

LPR/VMM API in C#

< 1 min read

This C# example demonstrates how to use HttpClient to send a GET request to an API for object detection. It constructs a URL with an image URL and API parameters, retrieves a response, and outputs the result, highlighting features like license plate detection and reading with specified parameters.

C# Example (using HttpClient) #


using System;
using System.Net.Http;
using System.Threading.Tasks;

class Program
{
    static async Task Main()
    {
        string apiUrl = "https://your-api-endpoint.com/ObjectDetection";
        string imageUrl = "https://example.com/car.jpg";
        string apiKey = "your_api_key";
        string ga = "your_ga_value";

        using (HttpClient client = new HttpClient())
        {
            string url = $"{apiUrl}?Image_url={Uri.EscapeDataString(imageUrl)}&Api_key={apiKey}&GA={ga}&Detect_license_plate=true&Read_license_plate=true";

            HttpResponseMessage response = await client.GetAsync(url);
            string result = await response.Content.ReadAsStringAsync();

            Console.WriteLine(result);
        }
    }
}