Sample code for 30+ languages & platforms
Xbase++ Requires Chilkat v11.0.0+

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 Xbase++ Downloads

Xbase++
LOCAL nSuccess
LOCAL oHttp
LOCAL oResp
LOCAL oJsonResponse
LOCAL cPurchaseOrderId
LOCAL cCustomerOrderId
LOCAL cCustomerEmailId
LOCAL nOrderDate
LOCAL cShippingInfoPhone
LOCAL nShippingInfoEstimatedDeliveryDate
LOCAL nShippingInfoEstimatedShipDate
LOCAL cShippingInfoMethodCode
LOCAL cShippingInfoPostalAddressName
LOCAL cShippingInfoPostalAddressAddress1
LOCAL cShippingInfoPostalAddressAddress2
LOCAL cShippingInfoPostalAddressCity
LOCAL cShippingInfoPostalAddressState
LOCAL cShippingInfoPostalAddressPostalCode
LOCAL cShippingInfoPostalAddressCountry
LOCAL cShippingInfoPostalAddressAddressType
LOCAL cShipNodeType
LOCAL j
LOCAL nCount_j
LOCAL cLineNumber
LOCAL cItemProductName
LOCAL cItemSku
LOCAL cOrderLineQuantityUnitOfMeasurement
LOCAL cOrderLineQuantityAmount
LOCAL nStatusDate
LOCAL cRefund
LOCAL cFulfillmentFulfillmentOption
LOCAL cFulfillmentShipMethod
LOCAL cFulfillmentStoreId
LOCAL nFulfillmentPickUpDateTime
LOCAL cFulfillmentPickUpBy
LOCAL cFulfillmentShippingProgramType
LOCAL k
LOCAL nCount_k
LOCAL cChargeType
LOCAL cChargeName
LOCAL cChargeAmountCurrency
LOCAL nChargeAmountAmount
LOCAL cTaxTaxName
LOCAL cTaxTaxAmountCurrency
LOCAL cTaxTaxAmountAmount
LOCAL cStatus
LOCAL cStatusQuantityUnitOfMeasurement
LOCAL cStatusQuantityAmount
LOCAL cCancellationReason
LOCAL cTrackingInfo
LOCAL cReturnCenterAddress
LOCAL nListMetaTotalCount
LOCAL nListMetaLimit
LOCAL cListMetaNextCursor
LOCAL i
LOCAL nCount_i

nSuccess := 0

//  This example requires the Chilkat API to have been previously unlocked.
//  See Global Unlock Sample for sample code.

oHttp := CreateObject("Chilkat.Http")

oHttp:Accept := "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))
oHttp:Login := "clientId"
oHttp:Password := "clientSecret"
oHttp:BasicAuth := 1

oHttp:SetRequestHeader("Content-Type", "application/json")
oHttp:SetRequestHeader("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
oHttp:SetRequestHeader("WM_SEC.ACCESS_TOKEN", "eyJraWQiOiIzZjVhYTFmNS1hYWE5LTQzM.....")
oHttp:SetRequestHeader("WM_SVC.NAME", "Walmart Marketplace")

oHttp:SetUrlVar("createdStartDate", "2020-01-16T10:30:15Z")
oHttp:SetUrlVar("limit", "200")
//  Can also be 3PLFulfilled
oHttp:SetUrlVar("shippingProgramType", "SellerFulfilled")
oHttp:SetUrlVar("shipNodeType", "TWO_DAY")

oResp := CreateObject("Chilkat.HttpResponse")
nSuccess := oHttp:HttpNoBody("GET", "/v3/orders/released?createdStartDate={$createdStartDate}&limit={$limit}&shippingProgramType={$shippingProgramType}&shipNodeType={$shipNodeType}", oResp)
IF (nSuccess == 0)
    ? oHttp:LastErrorText
    oHttp:destroy()
    oResp:destroy()
    RETURN
ENDIF

? "Response Status Code: " + Str(oResp:StatusCode)

oJsonResponse := CreateObject("Chilkat.JsonObject")
oJsonResponse:Load(oResp:BodyStr)
oJsonResponse:EmitCompact := 0
? oJsonResponse:Emit()

IF (oResp:StatusCode != 200)
    ? "Failed."
    oHttp:destroy()
    oResp:destroy()
    oJsonResponse:destroy()
    RETURN
ENDIF

//  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"
//            }
//          }
//        ]
//      }
//    }
//  }
//  

nListMetaTotalCount := oJsonResponse:IntOf("list.meta.totalCount")
nListMetaLimit := oJsonResponse:IntOf("list.meta.limit")
cListMetaNextCursor := oJsonResponse:StringOf("list.meta.nextCursor")
i := 0
nCount_i := oJsonResponse:SizeOfArray("list.elements.order")
DO WHILE i < nCount_i
    oJsonResponse:I := i
    cPurchaseOrderId := oJsonResponse:StringOf("list.elements.order[i].purchaseOrderId")
    cCustomerOrderId := oJsonResponse:StringOf("list.elements.order[i].customerOrderId")
    cCustomerEmailId := oJsonResponse:StringOf("list.elements.order[i].customerEmailId")
    nOrderDate := oJsonResponse:IntOf("list.elements.order[i].orderDate")
    cShippingInfoPhone := oJsonResponse:StringOf("list.elements.order[i].shippingInfo.phone")
    nShippingInfoEstimatedDeliveryDate := oJsonResponse:IntOf("list.elements.order[i].shippingInfo.estimatedDeliveryDate")
    nShippingInfoEstimatedShipDate := oJsonResponse:IntOf("list.elements.order[i].shippingInfo.estimatedShipDate")
    cShippingInfoMethodCode := oJsonResponse:StringOf("list.elements.order[i].shippingInfo.methodCode")
    cShippingInfoPostalAddressName := oJsonResponse:StringOf("list.elements.order[i].shippingInfo.postalAddress.name")
    cShippingInfoPostalAddressAddress1 := oJsonResponse:StringOf("list.elements.order[i].shippingInfo.postalAddress.address1")
    cShippingInfoPostalAddressAddress2 := oJsonResponse:StringOf("list.elements.order[i].shippingInfo.postalAddress.address2")
    cShippingInfoPostalAddressCity := oJsonResponse:StringOf("list.elements.order[i].shippingInfo.postalAddress.city")
    cShippingInfoPostalAddressState := oJsonResponse:StringOf("list.elements.order[i].shippingInfo.postalAddress.state")
    cShippingInfoPostalAddressPostalCode := oJsonResponse:StringOf("list.elements.order[i].shippingInfo.postalAddress.postalCode")
    cShippingInfoPostalAddressCountry := oJsonResponse:StringOf("list.elements.order[i].shippingInfo.postalAddress.country")
    cShippingInfoPostalAddressAddressType := oJsonResponse:StringOf("list.elements.order[i].shippingInfo.postalAddress.addressType")
    cShipNodeType := oJsonResponse:StringOf("list.elements.order[i].shipNode.type")
    j := 0
    nCount_j := oJsonResponse:SizeOfArray("list.elements.order[i].orderLines.orderLine")
    DO WHILE j < nCount_j
        oJsonResponse:J := j
        cLineNumber := oJsonResponse:StringOf("list.elements.order[i].orderLines.orderLine[j].lineNumber")
        cItemProductName := oJsonResponse:StringOf("list.elements.order[i].orderLines.orderLine[j].item.productName")
        cItemSku := oJsonResponse:StringOf("list.elements.order[i].orderLines.orderLine[j].item.sku")
        cOrderLineQuantityUnitOfMeasurement := oJsonResponse:StringOf("list.elements.order[i].orderLines.orderLine[j].orderLineQuantity.unitOfMeasurement")
        cOrderLineQuantityAmount := oJsonResponse:StringOf("list.elements.order[i].orderLines.orderLine[j].orderLineQuantity.amount")
        nStatusDate := oJsonResponse:IntOf("list.elements.order[i].orderLines.orderLine[j].statusDate")
        cRefund := oJsonResponse:StringOf("list.elements.order[i].orderLines.orderLine[j].refund")
        cFulfillmentFulfillmentOption := oJsonResponse:StringOf("list.elements.order[i].orderLines.orderLine[j].fulfillment.fulfillmentOption")
        cFulfillmentShipMethod := oJsonResponse:StringOf("list.elements.order[i].orderLines.orderLine[j].fulfillment.shipMethod")
        cFulfillmentStoreId := oJsonResponse:StringOf("list.elements.order[i].orderLines.orderLine[j].fulfillment.storeId")
        nFulfillmentPickUpDateTime := oJsonResponse:IntOf("list.elements.order[i].orderLines.orderLine[j].fulfillment.pickUpDateTime")
        cFulfillmentPickUpBy := oJsonResponse:StringOf("list.elements.order[i].orderLines.orderLine[j].fulfillment.pickUpBy")
        cFulfillmentShippingProgramType := oJsonResponse:StringOf("list.elements.order[i].orderLines.orderLine[j].fulfillment.shippingProgramType")
        k := 0
        nCount_k := oJsonResponse:SizeOfArray("list.elements.order[i].orderLines.orderLine[j].charges.charge")
        DO WHILE k < nCount_k
            oJsonResponse:K := k
            cChargeType := oJsonResponse:StringOf("list.elements.order[i].orderLines.orderLine[j].charges.charge[k].chargeType")
            cChargeName := oJsonResponse:StringOf("list.elements.order[i].orderLines.orderLine[j].charges.charge[k].chargeName")
            cChargeAmountCurrency := oJsonResponse:StringOf("list.elements.order[i].orderLines.orderLine[j].charges.charge[k].chargeAmount.currency")
            nChargeAmountAmount := oJsonResponse:IntOf("list.elements.order[i].orderLines.orderLine[j].charges.charge[k].chargeAmount.amount")
            cTaxTaxName := oJsonResponse:StringOf("list.elements.order[i].orderLines.orderLine[j].charges.charge[k].tax.taxName")
            cTaxTaxAmountCurrency := oJsonResponse:StringOf("list.elements.order[i].orderLines.orderLine[j].charges.charge[k].tax.taxAmount.currency")
            cTaxTaxAmountAmount := oJsonResponse:StringOf("list.elements.order[i].orderLines.orderLine[j].charges.charge[k].tax.taxAmount.amount")
            k := k + 1
        ENDDO
        k := 0
        nCount_k := oJsonResponse:SizeOfArray("list.elements.order[i].orderLines.orderLine[j].orderLineStatuses.orderLineStatus")
        DO WHILE k < nCount_k
            oJsonResponse:K := k
            cStatus := oJsonResponse:StringOf("list.elements.order[i].orderLines.orderLine[j].orderLineStatuses.orderLineStatus[k].status")
            cStatusQuantityUnitOfMeasurement := oJsonResponse:StringOf("list.elements.order[i].orderLines.orderLine[j].orderLineStatuses.orderLineStatus[k].statusQuantity.unitOfMeasurement")
            cStatusQuantityAmount := oJsonResponse:StringOf("list.elements.order[i].orderLines.orderLine[j].orderLineStatuses.orderLineStatus[k].statusQuantity.amount")
            cCancellationReason := oJsonResponse:StringOf("list.elements.order[i].orderLines.orderLine[j].orderLineStatuses.orderLineStatus[k].cancellationReason")
            cTrackingInfo := oJsonResponse:StringOf("list.elements.order[i].orderLines.orderLine[j].orderLineStatuses.orderLineStatus[k].trackingInfo")
            cReturnCenterAddress := oJsonResponse:StringOf("list.elements.order[i].orderLines.orderLine[j].orderLineStatuses.orderLineStatus[k].returnCenterAddress")
            k := k + 1
        ENDDO
        j := j + 1
    ENDDO
    i := i + 1
ENDDO

oHttp:destroy()
oResp:destroy()
oJsonResponse:destroy()