createExternalShipment
Requires permission sales:shipment:create.
Record a shipment an installed shipping app booked with its carrier. When none of the lines has shipped, the order ships through its own ship command (stock issues once, the order status moves, ship-after-invoice applies); this also needs sales:sales_order:ship. When all of them shipped already, only the booking is recorded and no stock moves. A request mixing the two is refused. No price is ever sent. Needs write_fulfillments.
Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.
Example:
- GraphQL
- cURL
mutation CreateExternalShipment($input: AppCreateExternalShipmentInput!) {
createExternalShipment(input: $input) {
id
orderNumber
returnNumber
shipmentNumber
trackingNumber
carrierName
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "mutation CreateExternalShipment($input: AppCreateExternalShipmentInput!) {\n createExternalShipment(input: $input) {\n id\n orderNumber\n returnNumber\n shipmentNumber\n trackingNumber\n carrierName\n }\n}",
"variables": {
"input": {
"items": [
{
"quantity": 0,
"salesOrderItemId": "id"
}
],
"salesOrderId": "id",
"trackingNumber": "string"
}
}
}
EOF
Variables:
{
"input": {
"items": [
{
"quantity": 0,
"salesOrderItemId": "id"
}
],
"salesOrderId": "id",
"trackingNumber": "string"
}
}
Response:
{
"data": {
"createExternalShipment": {
"id": "id",
"orderNumber": "string",
"returnNumber": "string",
"shipmentNumber": "string",
"trackingNumber": "string",
"carrierName": "string"
}
}
}
createExternalShipment(
input: AppCreateExternalShipmentInput!
): ShipmentListRow!
Arguments
createExternalShipment.input ● AppCreateExternalShipmentInput! non-null input
The shipment.
Type
ShipmentListRow object
One row of the shipments list.