acumaticaacumatica-kb

How can I add Sales Order Lines to a Shipment using the REST API?


I'm trying to use the REST API to create a shipment. I have the Sales Order / items that I want to add, but I get an error when using Postman. I'm using a PUT call for the Shipment endpoint, and I'm using the following JSON:

{
"Type": {
    "value": "Shipment"
},
"CustomerID": {
    "value": "2708"
},
"ShipmentDate": {
    "value": "04/25/2025"
},
"WarehouseID": {
    "value": "WAUKEGAN"
},
"Description": {
    "value": "Import to Acumatica via API test 1"
},
"Orders": [
    {
        "OrderNbr": {
            "value": "100072"
        },
        "OrderType": {
            "value": "SO"
        },
        "ShipmentType": {
            "value": "Shipment"
        },
        "ShippedQty": {
            "value": 8.000000
        }
    }
],
"ShipVia": {
    "value": "DELIVERY"
}

}

I've tried using Details instead of Orders, but that didn't work at all. Seeing as the UI doesn't seem to let you manually add lines to a shipment, I assumed I had to use the Orders instead of Details for the line items. The error I get is:

"error": "'ShipComplete' cannot be empty.; ShipComplete: 'ShipComplete' cannot be empty."

But I don't see a ShipComplete field anywhere.

Can someone please provide an example of how to add existing Sales Order lines to a Shipment via the REST API?

Thanks much,

Peter


Solution

  • Create a Shipment for Sales Orders

    PUT /entity/Default/24.200.001/Shipment?
        $select=Type,ShipmentNbr,Status,Details/InventoryID&
        $expand=Details HTTP/1.1
    Host: [<Acumatica ERP instance URL>]
    Accept: application/json
    Content-Type: application/json
    
    {
        "Type":{"value":"Shipment"},
        "CustomerID":{"value":"C000000003"},
        "WarehouseID":{"value":"MAIN"},
          "ShipmentDate":{"value":"2024-11-01"},
        "Details":[
            {
                "OrderType":{"value":"SO"},
                "OrderNbr":{"value":"000004"}
            },
            {
                "OrderType":{"value":"SO"},
                "OrderNbr":{"value":"000006"}
            }
        ]
    }
    

    Create a Shipment for Two Sales Orders with Allocations and Package Specifications

    PUT ?$expand=Details,Details/Allocations,Packages,Packages/PackageContents HTTP/1.1
    Host: [<Acumatica ERP instance URL>]/entity/Default/24.200.001/Shipment
    Accept: application/json
    Content-Type: application/json
    
    {
        "CustomerID": { "value": "GOODFOOD" },
        "Details": [
            {
                "OrderNbr": { "value": "000071" },
                "OrderType": { "value": "SO" },
                "OrderLineNbr": { "value": 1 },
                "Allocations": [
                    {
                        "InventoryID": { "value": "APJAM08" },
                        "LocationID": { "value": "L2R3S1" },
                        "Qty": { "value": 1 },
                        "UOM": { "value": "PIECE" }
                    },
                    {
                        "InventoryID": { "value": "APJAM08" },
                        "LocationID": { "value": "L3R2S1" },
                        "Qty": { "value": 1 },
                        "UOM": { "value": "PIECE" }
                    }
                ]
            },
            {
                "OrderNbr": { "value": "000072" },
                "OrderType": { "value": "SO" },
                "OrderLineNbr": { "value": 1 },
                "Allocations": [
                    {
                        "InventoryID": { "value": "APJAM32" },
                        "LocationID": { "value": "L1R3S2" },
                        "Qty": { "value": 6 },
                        "UOM": { "value": "PIECE" }
                    }
                ]
            }
        ],
        "LocationID": { "value": "MAIN" },
        "Operation": { "value": "Issue" },
        "Packages": [
            {
                "BoxID": { "value": "LARGE" },
                "UOM": { "value": "KG" },
                "Weight": { "value": 15 },
                "PackageContents": [
                    {
                        "InventoryID": { "value": "APJAM08" },
                        "LotSerialNbr": { "value": "" },
                        "Quantity": { "value": 1 },
                        "UOM": { "value": "PIECE" },
                        "OrigOrderType": { "value": "SO" },
                        "OrigOrderNbr": { "value": "000071" }
                    },
                    {
                        "InventoryID": { "value": "APJAM08" },
                        "LotSerialNbr": { "value": "" },
                        "Quantity": { "value": 1 },
                        "UOM": { "value": "PIECE" },
                        "OrigOrderType": { "value": "SO" },
                        "OrigOrderNbr": { "value": "000071" }
                    },
                    {
                        "InventoryID": { "value": "APJAM32" },
                        "LotSerialNbr": { "value": "" },
                        "Quantity": { "value": 6 },
                        "UOM": { "value": "PIECE" },
                        "OrigOrderType": { "value": "SO" },
                        "OrigOrderNbr": { "value": "000072" }
                    }
                ]
            }
        ],
        "WarehouseID": { "value": "WHOLESALE" }
    }