Shipments
After creating an order, you need to manifest it (assign a courier) and then retrieve shipment documents.
Imports
Section titled “Imports”import { BigshipClient, isSuccessResponse,} from '@agamya/bigship-sdk';Manifest — Assign Courier
Section titled “Manifest — Assign Courier”Use placeOrder to assign a courier and manifest the order.
await client.placeOrder({ MasterCustomOrderId: orderId, courierId: 5, // Delhivery Surface riskTypeId: '2', // Owner Risk});Get Order Detail — getOrderDetail
Section titled “Get Order Detail — getOrderDetail”Retrieve full AWB, label, and status details for a manifested order.
const details = await client.getOrderDetail(orderId);if (isSuccessResponse(details) && details.data) { console.log('AWB:', details.data.getOrderDetails.AwbNumber); console.log('Courier:', details.data.getOrderDetails.CourierName); console.log('Status:', details.data.getOrderDetails.Status);}Download Documents — downloadDocument
Section titled “Download Documents — downloadDocument”Retrieve labels, invoices, e-waybills, or manifests by document type.
// Get label (base64 Data URI or URL)const label = await client.downloadDocument(orderId, 'label');if (isSuccessResponse(label) && label.data) { console.log('Label:', label.data.AttachmentData);}
// Get manifest documentconst manifest = await client.downloadDocument(orderId, 'manifest');if (isSuccessResponse(manifest) && manifest.data) { console.log('Manifest document available');}Document Types
Section titled “Document Types”| Value | Description | Return type |
|---|---|---|
'invoice' |
Invoice document | Object with AttachmentData |
'label' |
Shipping label | Object with AttachmentData |
'ewaybill' |
E-waybill | Object with AttachmentData |
'manifest' |
Manifest document | Object with AttachmentData |
Workflow Builder — Fluent API
Section titled “Workflow Builder — Fluent API”import { BigshipClient, ShipmentWorkflow } from '@agamya/bigship-sdk';
const result = await new ShipmentWorkflow(client) .create(orderPayload) // Create order .withCourier(5) // Select courier .place() // Manifest .finalize(); // Get AWB + label + manifest
console.log(result.orderId);