I have a web api developed and deployed. It works with unit test and using fiddler. However, if i create a separate project and try to post data to it, it sends back a 400 Bad Request error. I am looking for a way to post this custom object using a client being written in C#. Unlike WCF there is no matadata to create proxy of these objects from and then instantiate and pass it on to calling methods. How do you pass a custom object like Customer as a parameter to a method?
URL would be http://host/directory/api/customer/AddNewCustomer and method definition is like
[HttpPost]
public bool AddNewCustomer(Customer customerObj)
EDIT
Following is my client code
HttpClient client = new HttpClient();
client.BaseAddress = new Uri("http://host/directory/");
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
client.Timeout = TimeSpan.FromSeconds(30.0);
// strong typed instance
var values = new JObject();
values.Add("FirstName", "John");
values.Add("LastName", "Doe");
HttpContent content = new StringContent(values.ToString(), Encoding.UTF8,"application/json");
var response = client.PostAsJsonAsync("api/customer/AddNewCustomer", content).Result;