Hi
Below error is returned by API . I want to display this message
C#
{"status":false,"message":"The Consignee Address field must be at least 5 characters in length.\n"}
***************** Below is the API
var body = new JavaScriptSerializer().Serialize(objShippingOrdr);
var client = new RestClient("htts://api.nimbuspost.com/v1/shipments");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", body, ParameterType.RequestBody);
var response = client.Execute(request);
*****************
public class RootShipment
{
public bool status { get; set; }
public DataShipment data { get; set; }
}Thanks

Pasang TamangRank #449 · 5.6K reputationPosted Jan 11, 2023, 1:20 AM EST
Hi,
You should be able to do it by adding message property in RootShipment class.
public class Root { public bool status { get; set; } public string message { get; set; } public DataShipment data { get; set; } }var responseOjb = JsonConvert.DeserializeObject(response.Content);In this case since you don't have anything to map with data object, you will get data as a null object.
Regards,
Pasang