RestSharp

POST Example

        
                using System;
                using System.Collections.Generic;
                using Newtonsoft.Json.Linq;
                using RestSharp;
                using RestSharp.Authenticators;
                using RestSharp.Serialization.Json;

                namespace restsharptutorial
                {
                class Program
                {

                    private static RestClient client = new RestClient("http://localhost:7071/api/");
                    
                    static void Main(string[] args)
                        {
                        Console.WriteLine("Hello World!");

                        JObject jObjectbody = new JObject();
                        jObjectbody.Add("name", "Fred");

                        RestRequest request = new RestRequest("function", Method.POST);
                        request.AddParameter("application/json", jObjectbody, ParameterType.RequestBody);

                        var restResponse = client.Execute(request);

                        ResponseData responseData = SimpleJson.DeserializeObject(restResponse.Content);

                        return;
                    }
                }
            
        

GET Example

        
            using System;
            using System.Collections.Generic;
            using Newtonsoft.Json.Linq;
            using RestSharp;
            using RestSharp.Authenticators;
            using RestSharp.Serialization.Json;

            namespace restsharptutorial
            {
                class Program
                {
                    private static RestClient client = new RestClient("http://localhost:7071/api/");
                    static void Main(string[] args)
                    {
                        Console.WriteLine("Hello World!");

                        RestRequest request = new RestRequest("function", Method.GET);
                        request.AddParameter("name", "1234");

                        var restResponse = client.Execute(request);

                        ResponseData responseData = SimpleJson.DeserializeObject(restResponse.Content);

                        var x = responseData;

                        return;
                    }                    
                }

                public class ResponseData
                {
                    public string name;
                    public int age;
                }
            }