Error in creating SaleShip through API

started a topic almost 4 years ago

When trying to add SaleShip through API I've got this error:

 [{"ErrorCode":400,"Exception":"Not all packed boxes listed in shipment lines. Remainig: Box 1"}]

Here is my code:


var saleShip = new SaleShip();

 saleShip.TaskID = SaleData.ID; // I have used the Sale ID for the TaskID

var ShipLine = new ShipLine();

ShipLine.ShipmentDate = DateTime.Now;

ShipLine.Boxes = SaleData.Pack.Lines.FirstOrDefault().Box;

ShipLine.Carrier = orderdata.ShippingMethodName;

ShipLine.TrackingNumber = orderdata.TrackingNo;

ShipLine.IsShipped = true;


// Serialize our concrete class into a JSON String

var stringPayload = JsonConvert.SerializeObject(saleShip);

// Wrap our JSON inside a StringContent which then can be used by the HttpClient class

var httpContent = new StringContent(stringPayload, Encoding.UTF8, "application/json");

            using (var client = CreateHttpClient(endpoint))




                    var response = client.PutAsync(endpoint, httpContent).Result;

                    var responseData = response.Content.ReadAsStringAsync();


                    if (responseData.IsCompleted)


                        return responseData.Result;



                catch (HttpRequestException ex)


                    throw new HttpRequestException(ex.Message);



Json object:

{"TaskID":"7ab58e87-cfb1-4d9b-8397-a3acd3a7ba60","Lines":[{"ShipmentDate":"2017-01-27T14:12:20.3611235+08:00","Carrier":"Interparcel","Boxes":"Box 1","TrackingNumber":"TEST TRACKING","IsShipped":true}]}

1 person has this question
Login or Signup to post a comment

1 person has this question
Log in or Sign up to post a comment