My Products
Help
andretvard
CONTRIBUTOR ***

Occasional BadRequest when updating Shipment

by andretvard

Hi 

 

We are having problems with the integration at one of our customers when we try to update the newly created shipments.

The problem is that sometimes we get the BadRequest response from the API.

We do not really see any pattern in that and do not understand why some calls go in fine and some fail (today we had 25 calls and 6 of them failed).

The data we send in the failed calls is possible to send in Swagger and than everything works.

We tried to implement the retry-logic and resend the data 3 times with 5 seconds interval but all calls get the BadRequest anyways.

Any ideas what it can mean and how we could debug it?

 

The example of data we send:

 

{
  "shipmentDetailLines": [
    {
      "operation": "update",
      "lineNumber": {
        "value": 1
      },
      "shippedQty": {
        "value": 1.0
      },
      "note": {
        "value": "00370730254645533012;000000000001377243;1"
      }
    },
    {
      "operation": "update",
      "lineNumber": {
        "value": 3
      },
      "shippedQty": {
        "value": 1.0
      },
      "note": {
        "value": "00370730254645533012;000000000001377243;1"
      }
    },
    {
      "operation": "update",
      "lineNumber": {
        "value": 4
      },
      "shippedQty": {
        "value": 1.0
      },
      "note": {
        "value": "00370730254645533012;000000000001377243;1"
      }
    },
    {
      "operation": "update",
      "lineNumber": {
        "value": 5
      },
      "shippedQty": {
        "value": 2.0
      },
      "note": {
        "value": "00370730254645533012;000000000001377243;2"
      }
    },
    {
      "operation": "update",
      "lineNumber": {
        "value": 6
      },
      "shippedQty": {
        "value": 2.0
      },
      "note": {
        "value": "00370730254645533012;000000000001377243;2"
      }
    },
    {
      "operation": "update",
      "lineNumber": {
        "value": 7
      },
      "shippedQty": {
        "value": 2.0
      },
      "note": {
        "value": "00370730254645533012;000000000001377243;2"
      }
    },
    {
      "operation": "update",
      "lineNumber": {
        "value": 8
      },
      "shippedQty": {
        "value": 2.0
      },
      "note": {
        "value": "00370730254645533012;000000000001377243;2"
      }
    },
    {
      "operation": "update",
      "lineNumber": {
        "value": 9
      },
      "shippedQty": {
        "value": 2.0
      },
      "note": {
        "value": "00370730254645533012;000000000001377243;2"
      }
    },
    {
      "operation": "update",
      "lineNumber": {
        "value": 10
      },
      "shippedQty": {
        "value": 1.0
      },
      "note": {
        "value": "00370730254645533012;000000000001377243;1"
      }
    }
  ],
  "shipmentPackageLines": [
    {
      "operation": "Insert",
      "lineNumber": {
        "value": 0
      },
      "boxId": {
        "value": "100"
      },
      "description": {
        "value": "ShippingLabel"
      },
      "trackingNumber": {
        "value": "00370730254645533012"
      }
    }
  ]
}

 

 

 

 

2 REPLIES 2
Accepted solution
andretvard
CONTRIBUTOR ***

by andretvard

Hi

It was just the BadRequest code that we received from the API despite the data was valid and correct.

But I think we have found a solution now.

We used to create shipments in two steps - first create it for the whole sales order and then update it with the data we wanted to have. And it is on the update request we got the errors.

But when we added a pause for 15 seconds between the create and update calls all the problems have disappeared!

Now we know that!

 

 

 

 

 

by Magnus Johnsen

Hi,

Are you receiving anything else in the error message? At first glance we can't see anything that's wrong with it.