2

I'm loking for a simple library to make REST client calls using JSON and compatible with .Net framework 2.0.

Any thoughts?

Thank you

dhalfageme
  • 1,444
  • 4
  • 21
  • 42

1 Answers1

-2

You can use the REST API asp.net or web-api with the following code.

Install the webapi client NuGet package for this:

    public class YourClass
    {
        private const string URL = "http://your_path/ob.json";
        private string urlParameters = "?api_key=123";

        static void Main(string[] args)
        {
            HttpClient client = new HttpClient();
            client.BaseAddress = new Uri(URL);

            // Add an Accept header for JSON format.
            client.DefaultRequestHeaders.Accept.Add(
            new MediaTypeWithQualityHeaderValue("application/json"));

            // List data response.
            HttpResponseMessage response = client.GetAsync(urlParameters).Result;  // Blocking call!
            if (response.IsSuccessStatusCode)
            {

            }
            else
            {
                // handle if false
            }  
        }
    }

Another solution is RESTsharp API

Riad
  • 3,822
  • 5
  • 28
  • 39