I have a a view model that looks like.
public class StoreItemViewModel
{
public Guid ItemId { get; set; }
public List StoreIds { get; set; }
I struggled with the same problem and came up a working solution.
Be sure to set the request format to JSON:
request.RequestFormat = DataFormat.Json;
Use AddBody, rather than AddObject:
request.AddBody(zNewSessionUsage);
So your code would be something like this:
public static IRestResponse Create(object objectToUpdate, string apiEndPoint) where T : new()
{
var client = new RestClient(CreateBaseUrl(null))
{
Authenticator = new HttpBasicAuthenticator("user", "Password1")
};
var request = new RestRequest(apiEndPoint, Method.POST);
request.RequestFormat = DataFormat.Json;
request.AddBody(objectToUpdate);
var response = client.Execute(request);
return response;
}