DataFlex
DataFlex
Walmart V3 API - Get All Released Orders
See more Walmart v3 Examples
Retrieves all the orders with line items that are in the "created" status, that is, these orders have been released from the Walmart Order Management System to the seller for processing. The released orders are the orders that are ready for a seller to fulfill.Chilkat DataFlex Downloads
Use ChilkatAx-win32.pkg
Procedure Test
Boolean iSuccess
Handle hoHttp
Variant vResp
Handle hoResp
Handle hoJsonResponse
String sPurchaseOrderId
String sCustomerOrderId
String sCustomerEmailId
Integer iOrderDate
String sShippingInfoPhone
Integer iShippingInfoEstimatedDeliveryDate
Integer iShippingInfoEstimatedShipDate
String sShippingInfoMethodCode
String sShippingInfoPostalAddressName
String sShippingInfoPostalAddressAddress1
String sShippingInfoPostalAddressAddress2
String sShippingInfoPostalAddressCity
String sShippingInfoPostalAddressState
String sShippingInfoPostalAddressPostalCode
String sShippingInfoPostalAddressCountry
String sShippingInfoPostalAddressAddressType
String sShipNodeType
Integer j
Integer iCount_j
String sLineNumber
String sItemProductName
String sItemSku
String sOrderLineQuantityUnitOfMeasurement
String sOrderLineQuantityAmount
Integer iStatusDate
String sRefund
String sFulfillmentFulfillmentOption
String sFulfillmentShipMethod
String sFulfillmentStoreId
Integer iFulfillmentPickUpDateTime
String sFulfillmentPickUpBy
String sFulfillmentShippingProgramType
Integer k
Integer iCount_k
String sChargeType
String sChargeName
String sChargeAmountCurrency
Integer iChargeAmountAmount
String sTaxTaxName
String sTaxTaxAmountCurrency
String sTaxTaxAmountAmount
String sStatus
String sStatusQuantityUnitOfMeasurement
String sStatusQuantityAmount
String sCancellationReason
String sTrackingInfo
String sReturnCenterAddress
Integer iListMetaTotalCount
Integer iListMetaLimit
String sListMetaNextCursor
Integer i
Integer iCount_i
String sTemp1
Integer iTemp1
Move False To iSuccess
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
Get Create (RefClass(cComChilkatHttp)) To hoHttp
If (Not(IsComObjectCreated(hoHttp))) Begin
Send CreateComObject of hoHttp
End
Set ComAccept Of hoHttp To "application/json"
// Setting the Login and Password properties to the clientId and clientSecret
// will cause the Basic Auth header to be added (i.e. BaseEncode64(clientId:clientSecret))
Set ComLogin Of hoHttp To "clientId"
Set ComPassword Of hoHttp To "clientSecret"
Set ComBasicAuth Of hoHttp To True
Send ComSetRequestHeader To hoHttp "Content-Type" "application/json"
Send ComSetRequestHeader To hoHttp "WM_QOS.CORRELATION_ID" "b3261d2d-028a-4ef7-8602-633c23200af6"
// Use the access token obtained from this example: Walmart v3 API Get OAuth2 Access Token using Client Credentials
Send ComSetRequestHeader To hoHttp "WM_SEC.ACCESS_TOKEN" "eyJraWQiOiIzZjVhYTFmNS1hYWE5LTQzM....."
Send ComSetRequestHeader To hoHttp "WM_SVC.NAME" "Walmart Marketplace"
Get ComSetUrlVar Of hoHttp "createdStartDate" "2020-01-16T10:30:15Z" To iSuccess
Get ComSetUrlVar Of hoHttp "limit" "200" To iSuccess
// Can also be 3PLFulfilled
Get ComSetUrlVar Of hoHttp "shippingProgramType" "SellerFulfilled" To iSuccess
Get ComSetUrlVar Of hoHttp "shipNodeType" "TWO_DAY" To iSuccess
Get Create (RefClass(cComChilkatHttpResponse)) To hoResp
If (Not(IsComObjectCreated(hoResp))) Begin
Send CreateComObject of hoResp
End
Get pvComObject of hoResp to vResp
Get ComHttpNoBody Of hoHttp "GET" "/v3/orders/released?createdStartDate={$createdStartDate}&limit={$limit}&shippingProgramType={$shippingProgramType}&shipNodeType={$shipNodeType}" vResp To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoHttp To sTemp1
Showln sTemp1
Procedure_Return
End
Get ComStatusCode Of hoResp To iTemp1
Showln "Response Status Code: " iTemp1
Get Create (RefClass(cComChilkatJsonObject)) To hoJsonResponse
If (Not(IsComObjectCreated(hoJsonResponse))) Begin
Send CreateComObject of hoJsonResponse
End
Get ComBodyStr Of hoResp To sTemp1
Get ComLoad Of hoJsonResponse sTemp1 To iSuccess
Set ComEmitCompact Of hoJsonResponse To False
Get ComEmit Of hoJsonResponse To sTemp1
Showln sTemp1
Get ComStatusCode Of hoResp To iTemp1
If (iTemp1 <> 200) Begin
Showln "Failed."
Procedure_Return
End
// Sample output...
// (See the parsing code below..)
//
// Use the this online tool to generate parsing code from sample JSON:
// Generate Parsing Code from JSON
// {
// "list": {
// "meta": {
// "totalCount": 25228,
// "limit": 10,
// "nextCursor": "?limit=10&hasMoreElements=true&soIndex=25228&poIndex=10&sellerId=152&createdStartDate=2019-04-02T00:00:00.000Z&createdEndDate=2019-09-26T16:05:49.648Z"
// },
// "elements": {
// "order": [
// {
// "purchaseOrderId": "4792701510371",
// "customerOrderId": "5401973367419",
// "customerEmailId": "47B81ACD2C62434DBE64F47B9E1F7630@relay.walmart.com",
// "orderDate": 1569513584000,
// "shippingInfo": {
// "phone": "2134488377",
// "estimatedDeliveryDate": 1569870000000,
// "estimatedShipDate": 1569553200000,
// "methodCode": "Express",
// "postalAddress": {
// "name": "Julio Hernandez",
// "address1": "9713 pleasant view dr",
// "address2": null,
// "city": "Rancho Cucamonga",
// "state": "CA",
// "postalCode": "91701",
// "country": "USA",
// "addressType": "RESIDENTIAL"
// }
// },
// "orderLines": {
// "orderLine": [
// {
// "lineNumber": "1",
// "item": {
// "productName": "Refurbished Lenovo YB1-X90F Grey Yoga Book with WiFi 10.1\" Touchscreen Tablet Android 6.0.1",
// "sku": "VO190403007727R"
// },
// "charges": {
// "charge": [
// {
// "chargeType": "PRODUCT",
// "chargeName": "ItemPrice",
// "chargeAmount": {
// "currency": "USD",
// "amount": 259
// },
// "tax": {
// "taxName": "Tax1",
// "taxAmount": {
// "currency": "USD",
// "amount": 20.07
// }
// }
// },
// {
// "chargeType": "FEE",
// "chargeName": "Fee",
// "chargeAmount": {
// "currency": "USD",
// "amount": 0
// },
// "tax": {
// "taxName": "Electronic Waste Recycling Fee",
// "taxAmount": {
// "currency": "USD",
// "amount": 5
// }
// }
// }
// ]
// },
// "orderLineQuantity": {
// "unitOfMeasurement": "EACH",
// "amount": "1"
// },
// "statusDate": 1569513724000,
// "orderLineStatuses": {
// "orderLineStatus": [
// {
// "status": "Acknowledged",
// "statusQuantity": {
// "unitOfMeasurement": "EACH",
// "amount": "1"
// },
// "cancellationReason": null,
// "trackingInfo": null,
// "returnCenterAddress": null
// }
// ]
// },
// "refund": null,
// "fulfillment": {
// "fulfillmentOption": "S2H",
// "shipMethod": "EXPEDITED",
// "storeId": null,
// "pickUpDateTime": 1569870000000,
// "pickUpBy": null,
// "shippingProgramType": "TWO_DAY"
// }
// }
// ]
// },
// "shipNode": {
// "type": "3PLFulfilled"
// }
// }
// ]
// }
// }
// }
//
Get ComIntOf Of hoJsonResponse "list.meta.totalCount" To iListMetaTotalCount
Get ComIntOf Of hoJsonResponse "list.meta.limit" To iListMetaLimit
Get ComStringOf Of hoJsonResponse "list.meta.nextCursor" To sListMetaNextCursor
Move 0 To i
Get ComSizeOfArray Of hoJsonResponse "list.elements.order" To iCount_i
While (i < iCount_i)
Set ComI Of hoJsonResponse To i
Get ComStringOf Of hoJsonResponse "list.elements.order[i].purchaseOrderId" To sPurchaseOrderId
Get ComStringOf Of hoJsonResponse "list.elements.order[i].customerOrderId" To sCustomerOrderId
Get ComStringOf Of hoJsonResponse "list.elements.order[i].customerEmailId" To sCustomerEmailId
Get ComIntOf Of hoJsonResponse "list.elements.order[i].orderDate" To iOrderDate
Get ComStringOf Of hoJsonResponse "list.elements.order[i].shippingInfo.phone" To sShippingInfoPhone
Get ComIntOf Of hoJsonResponse "list.elements.order[i].shippingInfo.estimatedDeliveryDate" To iShippingInfoEstimatedDeliveryDate
Get ComIntOf Of hoJsonResponse "list.elements.order[i].shippingInfo.estimatedShipDate" To iShippingInfoEstimatedShipDate
Get ComStringOf Of hoJsonResponse "list.elements.order[i].shippingInfo.methodCode" To sShippingInfoMethodCode
Get ComStringOf Of hoJsonResponse "list.elements.order[i].shippingInfo.postalAddress.name" To sShippingInfoPostalAddressName
Get ComStringOf Of hoJsonResponse "list.elements.order[i].shippingInfo.postalAddress.address1" To sShippingInfoPostalAddressAddress1
Get ComStringOf Of hoJsonResponse "list.elements.order[i].shippingInfo.postalAddress.address2" To sShippingInfoPostalAddressAddress2
Get ComStringOf Of hoJsonResponse "list.elements.order[i].shippingInfo.postalAddress.city" To sShippingInfoPostalAddressCity
Get ComStringOf Of hoJsonResponse "list.elements.order[i].shippingInfo.postalAddress.state" To sShippingInfoPostalAddressState
Get ComStringOf Of hoJsonResponse "list.elements.order[i].shippingInfo.postalAddress.postalCode" To sShippingInfoPostalAddressPostalCode
Get ComStringOf Of hoJsonResponse "list.elements.order[i].shippingInfo.postalAddress.country" To sShippingInfoPostalAddressCountry
Get ComStringOf Of hoJsonResponse "list.elements.order[i].shippingInfo.postalAddress.addressType" To sShippingInfoPostalAddressAddressType
Get ComStringOf Of hoJsonResponse "list.elements.order[i].shipNode.type" To sShipNodeType
Move 0 To j
Get ComSizeOfArray Of hoJsonResponse "list.elements.order[i].orderLines.orderLine" To iCount_j
While (j < iCount_j)
Set ComJ Of hoJsonResponse To j
Get ComStringOf Of hoJsonResponse "list.elements.order[i].orderLines.orderLine[j].lineNumber" To sLineNumber
Get ComStringOf Of hoJsonResponse "list.elements.order[i].orderLines.orderLine[j].item.productName" To sItemProductName
Get ComStringOf Of hoJsonResponse "list.elements.order[i].orderLines.orderLine[j].item.sku" To sItemSku
Get ComStringOf Of hoJsonResponse "list.elements.order[i].orderLines.orderLine[j].orderLineQuantity.unitOfMeasurement" To sOrderLineQuantityUnitOfMeasurement
Get ComStringOf Of hoJsonResponse "list.elements.order[i].orderLines.orderLine[j].orderLineQuantity.amount" To sOrderLineQuantityAmount
Get ComIntOf Of hoJsonResponse "list.elements.order[i].orderLines.orderLine[j].statusDate" To iStatusDate
Get ComStringOf Of hoJsonResponse "list.elements.order[i].orderLines.orderLine[j].refund" To sRefund
Get ComStringOf Of hoJsonResponse "list.elements.order[i].orderLines.orderLine[j].fulfillment.fulfillmentOption" To sFulfillmentFulfillmentOption
Get ComStringOf Of hoJsonResponse "list.elements.order[i].orderLines.orderLine[j].fulfillment.shipMethod" To sFulfillmentShipMethod
Get ComStringOf Of hoJsonResponse "list.elements.order[i].orderLines.orderLine[j].fulfillment.storeId" To sFulfillmentStoreId
Get ComIntOf Of hoJsonResponse "list.elements.order[i].orderLines.orderLine[j].fulfillment.pickUpDateTime" To iFulfillmentPickUpDateTime
Get ComStringOf Of hoJsonResponse "list.elements.order[i].orderLines.orderLine[j].fulfillment.pickUpBy" To sFulfillmentPickUpBy
Get ComStringOf Of hoJsonResponse "list.elements.order[i].orderLines.orderLine[j].fulfillment.shippingProgramType" To sFulfillmentShippingProgramType
Move 0 To k
Get ComSizeOfArray Of hoJsonResponse "list.elements.order[i].orderLines.orderLine[j].charges.charge" To iCount_k
While (k < iCount_k)
Set ComK Of hoJsonResponse To k
Get ComStringOf Of hoJsonResponse "list.elements.order[i].orderLines.orderLine[j].charges.charge[k].chargeType" To sChargeType
Get ComStringOf Of hoJsonResponse "list.elements.order[i].orderLines.orderLine[j].charges.charge[k].chargeName" To sChargeName
Get ComStringOf Of hoJsonResponse "list.elements.order[i].orderLines.orderLine[j].charges.charge[k].chargeAmount.currency" To sChargeAmountCurrency
Get ComIntOf Of hoJsonResponse "list.elements.order[i].orderLines.orderLine[j].charges.charge[k].chargeAmount.amount" To iChargeAmountAmount
Get ComStringOf Of hoJsonResponse "list.elements.order[i].orderLines.orderLine[j].charges.charge[k].tax.taxName" To sTaxTaxName
Get ComStringOf Of hoJsonResponse "list.elements.order[i].orderLines.orderLine[j].charges.charge[k].tax.taxAmount.currency" To sTaxTaxAmountCurrency
Get ComStringOf Of hoJsonResponse "list.elements.order[i].orderLines.orderLine[j].charges.charge[k].tax.taxAmount.amount" To sTaxTaxAmountAmount
Move (k + 1) To k
Loop
Move 0 To k
Get ComSizeOfArray Of hoJsonResponse "list.elements.order[i].orderLines.orderLine[j].orderLineStatuses.orderLineStatus" To iCount_k
While (k < iCount_k)
Set ComK Of hoJsonResponse To k
Get ComStringOf Of hoJsonResponse "list.elements.order[i].orderLines.orderLine[j].orderLineStatuses.orderLineStatus[k].status" To sStatus
Get ComStringOf Of hoJsonResponse "list.elements.order[i].orderLines.orderLine[j].orderLineStatuses.orderLineStatus[k].statusQuantity.unitOfMeasurement" To sStatusQuantityUnitOfMeasurement
Get ComStringOf Of hoJsonResponse "list.elements.order[i].orderLines.orderLine[j].orderLineStatuses.orderLineStatus[k].statusQuantity.amount" To sStatusQuantityAmount
Get ComStringOf Of hoJsonResponse "list.elements.order[i].orderLines.orderLine[j].orderLineStatuses.orderLineStatus[k].cancellationReason" To sCancellationReason
Get ComStringOf Of hoJsonResponse "list.elements.order[i].orderLines.orderLine[j].orderLineStatuses.orderLineStatus[k].trackingInfo" To sTrackingInfo
Get ComStringOf Of hoJsonResponse "list.elements.order[i].orderLines.orderLine[j].orderLineStatuses.orderLineStatus[k].returnCenterAddress" To sReturnCenterAddress
Move (k + 1) To k
Loop
Move (j + 1) To j
Loop
Move (i + 1) To i
Loop
End_Procedure