Send a Rest call and return results in JSON.
public class RestClient
Dictionary of header keys and values to pass with the Rest call.
Dictionary of query string key and values to pass with the Rest call
public Response Get<Response>(string url, string endPoint)
Makes a GET request to a Rest endpoint.
The object type to deserialise the JSON into for returning.
Remote URL to call without the endpoint api name.
The API endpoint to call.
public Response Post<Send, Response>(string url, string endPoint,
Send data)
Makes a POST request to a Rest endpoint.
The object type containing data to serialise into JSON to send to the remote endpoint.
The object type to deserialise the JSON into for returning.
Remote URL to call without the endpoint api name.
The API endpoint to call.
The object containing data to serialise into JSON to send to the remote endpoint.
var rc = new RestClient();rc.Headers.Add("header1", "MyHeaderValue1");rc.Headers.Add("header2", "MyHeaderValue2");var x = rc.Get(AppValue.ApiServer, "MyApi"); public class MyData{ public string Prop1 { get; set; } public string Prop2 { get; set; }}MyData data = new MyData() { Prop1 = "MyValue1", Prop1 = "MyValue2"};var rc = new RestClient();rc.Headers.Add("header1", "MyHeaderValue1");rc.Headers.Add("header2", "MyHeaderValue2");var x = rc.Post(AppValue.ApiServer, "MyApi", data);