You’re running into a pretty classic data import problem. A different version of it might be trying to link a Contact to a Customer that hasn’t been created inside the system yet.
One approach would be ensuring that all of the serialized items you are attempting to add to sales orders already exist in the system and are Available For Shipping before trying to add it to an order. So one way the REST api might be handy is we could query the system for the necessary allocated inventory before attempting to add it to the sales order line.
Before we choose an approach, however, can you fill us in a little on the state of your system? Is this a system that is live currently (i.e. receiving shipments, shipping product, etc)? I guess I’m trying to understand why you would run into a situation where the inventory you are trying to allocate to a sales order line would not be Available for Shipping (i.e. you are importing data from a legacy system, where some of the inventory that needs to be linked up has been sold long ago, so it’s not “Available for Shipping”)?