Hi
Below error is returned by API . I want to display this message
{"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 TamangPosted Jan 11, 2023, 6:20 AM
Hi,
You should be able to do it by adding message property in RootShipment class.
In this case since you don't have anything to map with data object, you will get data as a null object.
Regards,
Pasang