Ramco Ramco

Ramco Ramco

  • 439
  • 3.4k
  • 544.6k

Ambiquity between ShipmentHistory.status_code

Jan 14 2023 9:54 AM

Hi

I am getting this error - Ambiquity between ShipmentHistory.status_code and ShipmentHistory.status_code

Below is the data returned by API -

{"status":true,"data":{"id":"17272102","order_id":"31160140","order_number":"2003","created":"2023-01-11","edd":"","pickup_date":"","rto_initiate_date":"","delivered_date":"","shipped_date":"","awb_number":"81100381950","rto_awb":"","courier_id":"5","warehouse_id":"133763","rto_warehouse_id":"133763","status":"pending pickup","rto_status":"","shipment_info":"CAR \/ CMM","history":[{"status_code":"PP","location":"GURUGRAM (CTY)","event_time":"2023-01-11 10:46","message":"Online shipment booked"}]}}
ShipmentHistoryRootObject rootObject = new ShipmentHistoryRootObject();
rootObject = JsonConvert.DeserializeObject<ShipmentHistoryRootObject>(response.Content);

ShipmentTrackingHistory objshipmentHistory = new ShipmentTrackingHistory();
foreach (var item in rootObject.data.history)
{
    objshipmentHistory.AWBNumber = rootObject.data.awb_number;
    objshipmentHistory.OrderID = rootObject.data.order_id;
    objshipmentHistory.OrderNumber = rootObject.data.order_number;
    objshipmentHistory.StatusCode = item.status_code;
    objshipmentHistory.EventTime = item.event_time;
    objshipmentHistory.Location = item.location;
    objshipmentHistory.Message = item.message;
    
}
public class ShipmentHistoryRootObject
{
    public string status { get; set; }
    public ShipmentHistoryOrderDetails data { get; set; }
}

public class ShipmentHistoryOrderDetails
{
    public string id { get; set; }
    public string order_id { get; set; }
    public string order_number { get; set; }
    public string created { get; set; }
    public string awb_number { get; set; }
    public string rto_awb { get; set; }
    public string courier_id { get; set; }
    public string warehouse_id { get; set; }
    public string rto_warehouse_id { get; set; }
    public string status { get; set; }
    public string rto_status { get; set; }
    public string shipment_info { get; set; }
    public List<ShipmentHistory> history { get; set; }
}

public class ShipmentHistory
{
    public string status_code { get; set; }
    public string location { get; set; }
    public string event_time { get; set; }
    public string message { get; set; }
}

Thanks


Answers (1)