Object to JSON issue in RestSharp

Viewed 3348

The Rest API I am using has a new field called Api-Key. This is not a valid C# field name so I am wondering if there is a different way of building the body.

   var client = new RestClient("https://TestWeb");

        var request = new RestRequest("login", Method.POST);
        request.AddHeader("Content-type", "application/json");

        request.AddJsonBody(
           new {
               credentials =
            new
            {
                username = "Uname",
                password = "password",
                Api-Key = "apikey"
            } }); 
1 Answers
Related