Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(AutoIt) Walmart v3 Ship Order LinesSee more Walmart v3 ExamplesUpdates the status of order lines to Shipped and trigger the charge to the customer. The response to a successful call contains the order with the shipped line items. For more information, see https://developer.walmart.com/api/us/mp/orders#operation/shippingUpdates
; This example assumes the Chilkat API to have been previously unlocked. ; See Global Unlock Sample for sample code. $oHttp = ObjCreate("Chilkat.Http") Local $bSuccess $oHttp.SetRequestHeader "WM_QOS.CORRELATION_ID","b3261d2d-028a-4ef7-8602-633c23200af6" $oHttp.SetRequestHeader "WM_SEC.ACCESS_TOKEN","eyJraWQiOiIzZjVhYTFmNS1hYWE5LTQzM....." $oHttp.SetRequestHeader "Accept","application/json" $oHttp.SetRequestHeader "WM_SVC.NAME","Walmart Marketplace" ; Send the following in the request body: ; { ; "orderShipment": { ; "orderLines": { ; "orderLine": [ ; { ; "lineNumber": "1", ; "intentToCancelOverride": false, ; "sellerOrderId": "92344", ; "orderLineStatuses": { ; "orderLineStatus": [ ; { ; "status": "Shipped", ; "statusQuantity": { ; "unitOfMeasurement": "EACH", ; "amount": "1" ; }, ; "trackingInfo": { ; "shipDateTime": 1580821866000, ; "carrierName": { ; "carrier": "UPS" ; }, ; "methodCode": "Standard", ; "trackingNumber": "22344", ; "trackingURL": "http://walmart/tracking/ups?&type=MP&seller_id=12345&promise_date=03/02/2020&dzip=92840&tracking_numbers=92345" ; }, ; "returnCenterAddress": { ; "name": "walmart", ; "address1": "walmart store 2", ; "city": "Huntsville", ; "state": "AL", ; "postalCode": "35805", ; "country": "USA", ; "dayPhone": "12344", ; "emailId": "walmart@walmart.com" ; } ; } ; ] ; } ; }, ; { ; "lineNumber": "2", ; "sellerOrderId": "92344", ; "orderLineStatuses": { ; "orderLineStatus": [ ; { ; "status": "Shipped", ; "statusQuantity": { ; "unitOfMeasurement": "EACH", ; "amount": "1" ; }, ; "trackingInfo": { ; "shipDateTime": 1580821866000, ; "carrierName": { ; "carrier": "FedEx" ; }, ; "methodCode": "Express", ; "trackingNumber": "22344", ; "trackingURL": "http://walmart/tracking/fedEx?&type=MP&seller_id=12345&promise_date=03/02/2020&dzip=92840&tracking_numbers=92344" ; }, ; "returnCenterAddress": { ; "name": "walmart", ; "address1": "walmart store 2", ; "city": "Huntsville", ; "state": "AL", ; "postalCode": "35805", ; "country": "USA", ; "dayPhone": "12344", ; "emailId": "walmart@walmart.com" ; } ; } ; ] ; } ; } ; ] ; } ; } ; } $oJson = ObjCreate("Chilkat.JsonObject") Local $iOrderLineIndex = 0 Local $iStatusIndex = 0 $oJson.I = $iOrderLineIndex $oJson.J = $iStatusIndex $oJson.UpdateString("orderShipment.orderLines.orderLine[i].lineNumber","1") $oJson.UpdateBool("orderShipment.orderLines.orderLine[i].intentToCancelOverride",False) $oJson.UpdateString("orderShipment.orderLines.orderLine[i].sellerOrderId","92344") $oJson.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].status","Shipped") $oJson.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].statusQuantity.unitOfMeasurement","EACH") $oJson.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].statusQuantity.amount","1") $oJson.UpdateInt("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.shipDateTime",123) $oJson.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.carrierName.carrier","UPS") $oJson.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.methodCode","Standard") $oJson.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.trackingNumber","22344") $oJson.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.trackingURL","http://walmart/tracking/ups?&type=MP&seller_id=12345&promise_date=03/02/2020&dzip=92840&tracking_numbers=92345") $oJson.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.name","walmart") $oJson.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.address1","walmart store 2") $oJson.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.city","Huntsville") $oJson.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.state","AL") $oJson.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.postalCode","35805") $oJson.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.country","USA") $oJson.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.dayPhone","12344") $oJson.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.emailId","walmart@walmart.com") $iOrderLineIndex = $iOrderLineIndex + 1 $iStatusIndex = 0 $oJson.I = $iOrderLineIndex $oJson.J = $iStatusIndex $oJson.UpdateString("orderShipment.orderLines.orderLine[i].lineNumber","2") $oJson.UpdateString("orderShipment.orderLines.orderLine[i].sellerOrderId","92344") $oJson.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].status","Shipped") $oJson.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].statusQuantity.unitOfMeasurement","EACH") $oJson.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].statusQuantity.amount","1") $oJson.UpdateInt("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.shipDateTime",123) $oJson.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.carrierName.carrier","FedEx") $oJson.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.methodCode","Express") $oJson.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.trackingNumber","22344") $oJson.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.trackingURL","http://walmart/tracking/fedEx?&type=MP&seller_id=12345&promise_date=03/02/2020&dzip=92840&tracking_numbers=92344") $oJson.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.name","walmart") $oJson.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.address1","walmart store 2") $oJson.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.city","Huntsville") $oJson.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.state","AL") $oJson.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.postalCode","35805") $oJson.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.country","USA") $oJson.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.dayPhone","12344") $oJson.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.emailId","walmart@walmart.com") Local $oResp = $oHttp.PostJson3("https://api-gateway.walmart.com/v3/orders/{purchaseOrderId}/shipping","application/json",$oJson) If ($oHttp.LastMethodSuccess = False) Then ConsoleWrite($oHttp.LastErrorText & @CRLF) Exit EndIf ConsoleWrite("Response status code: " & $oResp.StatusCode & @CRLF) $oResp.GetBodyJson($oJson) ; A sample JSON response: ; { ; "order": { ; "purchaseOrderId": "1234567891234", ; "customerOrderId": "9876543212345", ; "sellerOrderId": "13233454564657", ; "customerEmailId": "customer@walmartlabs.com", ; "orderDate": 1478284060000, ; "shippingInfo": { ; "phone": "6501234567", ; "estimatedDeliveryDate": 1479798000000, ; "estimatedShipDate": 1478674800000, ; "methodCode": "Value", ; "postalAddress": { ; "name": "Jane Doe", ; "address1": "123 Main street", ; "city": "Sunnyvale", ; "state": "CA", ; "postalCode": "94086", ; "country": "USA", ; "addressType": "OFFICE" ; } ; }, ; "orderLines": { ; "orderLine": [ ; { ; "lineNumber": "1", ; "item": { ; "productName": "Kenmore CF-1 or 20-86883 Canister Secondary Filter Generic 2 Pack", ; "sku": "wei-ASSET-675gku675" ; }, ; "charges": { ; "charge": [ ; { ; "chargeType": "PRODUCT", ; "chargeName": "ItemPrice", ; "chargeAmount": { ; "currency": "USD", ; "amount": 555 ; }, ; "tax": { ; "taxName": "Tax1", ; "taxAmount": { ; "currency": "USD", ; "amount": 48.56 ; } ; } ; } ; ] ; }, ; "orderLineQuantity": { ; "unitOfMeasurement": "EACH", ; "amount": "1" ; }, ; "statusDate": 1478297929000, ; "orderLineStatuses": { ; "orderLineStatus": [ ; { ; "status": "Shipped", ; "statusQuantity": { ; "unitOfMeasurement": "EACH", ; "amount": "1" ; }, ; "trackingInfo": { ; "shipDateTime": 1438163400000, ; "carrierName": { ; "carrier": "FedEx" ; }, ; "methodCode": "Value", ; "trackingNumber": "911001572321619861", ; "trackingURL": "http://www.fedex.com/Tracking?action=track=english=us=x=911001572321619861" ; }, ; "returnCenterAddress": { ; "name": "ABC", ; "address1": "123 Bridge street", ; "city": "Huntsville", ; "state": "AL", ; "postalCode": "35805", ; "country": "USA", ; "dayPhone": "6501234567", ; "emailId": "RCemailaddress@company.com" ; } ; } ; ] ; } ; } ; ] ; } ; } ; } $oJson.EmitCompact = False ConsoleWrite("Response JSON:" & @CRLF) ConsoleWrite($oJson.Emit() & @CRLF) ; Insert code here to load the above JSON into the json object. Local $sLineNumber Local $sProductName Local $sSku Local $sUnitOfMeasurement Local $sAmount Local $iStatusDate Local $iCount_j Local $sChargeType Local $sChargeName Local $sV_Currency Local $iChargeAmountAmount Local $sTaxName Local $sTaxAmountCurrency Local $sTaxAmountAmount Local $status Local $statusQuantityUnitOfMeasurement Local $statusQuantityAmount Local $iShipDateTime Local $sCarrier Local $sTrackingInfoMethodCode Local $sTrackingNumber Local $sTrackingURL Local $sReturnCenterAddressName Local $sReturnCenterAddressAddress1 Local $sReturnCenterAddressCity Local $sReturnCenterAddressState Local $sReturnCenterAddressPostalCode Local $sReturnCenterAddressCountry Local $sDayPhone Local $sEmailId Local $sPurchaseOrderId = $oJson.StringOf("order.purchaseOrderId") Local $sCustomerOrderId = $oJson.StringOf("order.customerOrderId") Local $sSellerOrderId = $oJson.StringOf("order.sellerOrderId") Local $sCustomerEmailId = $oJson.StringOf("order.customerEmailId") Local $iOrderDate = $oJson.IntOf("order.orderDate") Local $sPhone = $oJson.StringOf("order.shippingInfo.phone") Local $iEstimatedDeliveryDate = $oJson.IntOf("order.shippingInfo.estimatedDeliveryDate") Local $iEstimatedShipDate = $oJson.IntOf("order.shippingInfo.estimatedShipDate") Local $sMethodCode = $oJson.StringOf("order.shippingInfo.methodCode") Local $sName = $oJson.StringOf("order.shippingInfo.postalAddress.name") Local $sAddress1 = $oJson.StringOf("order.shippingInfo.postalAddress.address1") Local $sCity = $oJson.StringOf("order.shippingInfo.postalAddress.city") Local $sState = $oJson.StringOf("order.shippingInfo.postalAddress.state") Local $sPostalCode = $oJson.StringOf("order.shippingInfo.postalAddress.postalCode") Local $sCountry = $oJson.StringOf("order.shippingInfo.postalAddress.country") Local $sAddressType = $oJson.StringOf("order.shippingInfo.postalAddress.addressType") Local $i = 0 Local $iJ = 0 Local $iCount_i = $oJson.SizeOfArray("order.orderLines.orderLine") While $i < $iCount_i $oJson.I = $i $sLineNumber = $oJson.StringOf("order.orderLines.orderLine[i].lineNumber") $sProductName = $oJson.StringOf("order.orderLines.orderLine[i].item.productName") $sSku = $oJson.StringOf("order.orderLines.orderLine[i].item.sku") $sUnitOfMeasurement = $oJson.StringOf("order.orderLines.orderLine[i].orderLineQuantity.unitOfMeasurement") $sAmount = $oJson.StringOf("order.orderLines.orderLine[i].orderLineQuantity.amount") $iStatusDate = $oJson.IntOf("order.orderLines.orderLine[i].statusDate") $iJ = 0 $iCount_j = $oJson.SizeOfArray("order.orderLines.orderLine[i].charges.charge") While $iJ < $iCount_j $oJson.J = $iJ $sChargeType = $oJson.StringOf("order.orderLines.orderLine[i].charges.charge[j].chargeType") $sChargeName = $oJson.StringOf("order.orderLines.orderLine[i].charges.charge[j].chargeName") $sV_Currency = $oJson.StringOf("order.orderLines.orderLine[i].charges.charge[j].chargeAmount.currency") $iChargeAmountAmount = $oJson.IntOf("order.orderLines.orderLine[i].charges.charge[j].chargeAmount.amount") $sTaxName = $oJson.StringOf("order.orderLines.orderLine[i].charges.charge[j].tax.taxName") $sTaxAmountCurrency = $oJson.StringOf("order.orderLines.orderLine[i].charges.charge[j].tax.taxAmount.currency") $sTaxAmountAmount = $oJson.StringOf("order.orderLines.orderLine[i].charges.charge[j].tax.taxAmount.amount") $iJ = $iJ + 1 Wend $iJ = 0 $iCount_j = $oJson.SizeOfArray("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus") While $iJ < $iCount_j $oJson.J = $iJ $status = $oJson.StringOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].status") $statusQuantityUnitOfMeasurement = $oJson.StringOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].statusQuantity.unitOfMeasurement") $statusQuantityAmount = $oJson.StringOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].statusQuantity.amount") $iShipDateTime = $oJson.IntOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.shipDateTime") $sCarrier = $oJson.StringOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.carrierName.carrier") $sTrackingInfoMethodCode = $oJson.StringOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.methodCode") $sTrackingNumber = $oJson.StringOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.trackingNumber") $sTrackingURL = $oJson.StringOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.trackingURL") $sReturnCenterAddressName = $oJson.StringOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.name") $sReturnCenterAddressAddress1 = $oJson.StringOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.address1") $sReturnCenterAddressCity = $oJson.StringOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.city") $sReturnCenterAddressState = $oJson.StringOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.state") $sReturnCenterAddressPostalCode = $oJson.StringOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.postalCode") $sReturnCenterAddressCountry = $oJson.StringOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.country") $sDayPhone = $oJson.StringOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.dayPhone") $sEmailId = $oJson.StringOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.emailId") $iJ = $iJ + 1 Wend $i = $i + 1 Wend |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.