I am testing APIs and currently, I am testing a Post method that returns a Long data type Id.
I have created a C# object class, where I also have other properties that it will return from another API call. For now, this Post call only returns an Id and I want to Map it to the Id property in my class but I get an exception Could not cast or convert from System.Int64
to Model class
// Here is my model class
public class Model
{
public long id { get; set; }
public string name { get; set; }
public long type { get; set; }
}
// Here is the call I am making.. FYI I am using RestSharp
response = HttpPost("URl");
var id = JsonConvert.DeserializeObject<Model.id>(restResponse.Content); //How can I map just the Id.
My response from the API is a long data type ex: 658