Sample code for 30+ languages & platforms
Delphi DLL 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 Delphi DLL Downloads

Delphi DLL
var
success: Boolean;
http: HCkHttp;
resp: HCkHttpResponse;
jsonResponse: HCkJsonObject;
purchaseOrderId: PWideChar;
customerOrderId: PWideChar;
customerEmailId: PWideChar;
orderDate: Integer;
shippingInfoPhone: PWideChar;
shippingInfoEstimatedDeliveryDate: Integer;
shippingInfoEstimatedShipDate: Integer;
shippingInfoMethodCode: PWideChar;
shippingInfoPostalAddressName: PWideChar;
shippingInfoPostalAddressAddress1: PWideChar;
shippingInfoPostalAddressAddress2: PWideChar;
shippingInfoPostalAddressCity: PWideChar;
shippingInfoPostalAddressState: PWideChar;
shippingInfoPostalAddressPostalCode: PWideChar;
shippingInfoPostalAddressCountry: PWideChar;
shippingInfoPostalAddressAddressType: PWideChar;
shipNodeType: PWideChar;
j: Integer;
count_j: Integer;
lineNumber: PWideChar;
itemProductName: PWideChar;
itemSku: PWideChar;
orderLineQuantityUnitOfMeasurement: PWideChar;
orderLineQuantityAmount: PWideChar;
statusDate: Integer;
refund: PWideChar;
fulfillmentFulfillmentOption: PWideChar;
fulfillmentShipMethod: PWideChar;
fulfillmentStoreId: PWideChar;
fulfillmentPickUpDateTime: Integer;
fulfillmentPickUpBy: PWideChar;
fulfillmentShippingProgramType: PWideChar;
k: Integer;
count_k: Integer;
chargeType: PWideChar;
chargeName: PWideChar;
chargeAmountCurrency: PWideChar;
chargeAmountAmount: Integer;
taxTaxName: PWideChar;
taxTaxAmountCurrency: PWideChar;
taxTaxAmountAmount: PWideChar;
status: PWideChar;
statusQuantityUnitOfMeasurement: PWideChar;
statusQuantityAmount: PWideChar;
cancellationReason: PWideChar;
trackingInfo: PWideChar;
returnCenterAddress: PWideChar;
listMetaTotalCount: Integer;
listMetaLimit: Integer;
listMetaNextCursor: PWideChar;
i: Integer;
count_i: Integer;

begin
success := False;

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

http := CkHttp_Create();

CkHttp_putAccept(http,'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))
CkHttp_putLogin(http,'clientId');
CkHttp_putPassword(http,'clientSecret');
CkHttp_putBasicAuth(http,True);

CkHttp_SetRequestHeader(http,'Content-Type','application/json');
CkHttp_SetRequestHeader(http,'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
CkHttp_SetRequestHeader(http,'WM_SEC.ACCESS_TOKEN','eyJraWQiOiIzZjVhYTFmNS1hYWE5LTQzM.....');
CkHttp_SetRequestHeader(http,'WM_SVC.NAME','Walmart Marketplace');

CkHttp_SetUrlVar(http,'createdStartDate','2020-01-16T10:30:15Z');
CkHttp_SetUrlVar(http,'limit','200');
//  Can also be 3PLFulfilled
CkHttp_SetUrlVar(http,'shippingProgramType','SellerFulfilled');
CkHttp_SetUrlVar(http,'shipNodeType','TWO_DAY');

resp := CkHttpResponse_Create();
success := CkHttp_HttpNoBody(http,'GET','/v3/orders/released?createdStartDate={$createdStartDate}&limit={$limit}&shippingProgramType={$shippingProgramType}&shipNodeType={$shipNodeType}',resp);
if (success = False) then
  begin
    Memo1.Lines.Add(CkHttp__lastErrorText(http));
    Exit;
  end;

Memo1.Lines.Add('Response Status Code: ' + IntToStr(CkHttpResponse_getStatusCode(resp)));

jsonResponse := CkJsonObject_Create();
CkJsonObject_Load(jsonResponse,CkHttpResponse__bodyStr(resp));
CkJsonObject_putEmitCompact(jsonResponse,False);
Memo1.Lines.Add(CkJsonObject__emit(jsonResponse));

if (CkHttpResponse_getStatusCode(resp) <> 200) then
  begin
    Memo1.Lines.Add('Failed.');
    Exit;
  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"
//            }
//          }
//        ]
//      }
//    }
//  }
//  

listMetaTotalCount := CkJsonObject_IntOf(jsonResponse,'list.meta.totalCount');
listMetaLimit := CkJsonObject_IntOf(jsonResponse,'list.meta.limit');
listMetaNextCursor := CkJsonObject__stringOf(jsonResponse,'list.meta.nextCursor');
i := 0;
count_i := CkJsonObject_SizeOfArray(jsonResponse,'list.elements.order');
while i < count_i do
  begin
    CkJsonObject_putI(jsonResponse,i);
    purchaseOrderId := CkJsonObject__stringOf(jsonResponse,'list.elements.order[i].purchaseOrderId');
    customerOrderId := CkJsonObject__stringOf(jsonResponse,'list.elements.order[i].customerOrderId');
    customerEmailId := CkJsonObject__stringOf(jsonResponse,'list.elements.order[i].customerEmailId');
    orderDate := CkJsonObject_IntOf(jsonResponse,'list.elements.order[i].orderDate');
    shippingInfoPhone := CkJsonObject__stringOf(jsonResponse,'list.elements.order[i].shippingInfo.phone');
    shippingInfoEstimatedDeliveryDate := CkJsonObject_IntOf(jsonResponse,'list.elements.order[i].shippingInfo.estimatedDeliveryDate');
    shippingInfoEstimatedShipDate := CkJsonObject_IntOf(jsonResponse,'list.elements.order[i].shippingInfo.estimatedShipDate');
    shippingInfoMethodCode := CkJsonObject__stringOf(jsonResponse,'list.elements.order[i].shippingInfo.methodCode');
    shippingInfoPostalAddressName := CkJsonObject__stringOf(jsonResponse,'list.elements.order[i].shippingInfo.postalAddress.name');
    shippingInfoPostalAddressAddress1 := CkJsonObject__stringOf(jsonResponse,'list.elements.order[i].shippingInfo.postalAddress.address1');
    shippingInfoPostalAddressAddress2 := CkJsonObject__stringOf(jsonResponse,'list.elements.order[i].shippingInfo.postalAddress.address2');
    shippingInfoPostalAddressCity := CkJsonObject__stringOf(jsonResponse,'list.elements.order[i].shippingInfo.postalAddress.city');
    shippingInfoPostalAddressState := CkJsonObject__stringOf(jsonResponse,'list.elements.order[i].shippingInfo.postalAddress.state');
    shippingInfoPostalAddressPostalCode := CkJsonObject__stringOf(jsonResponse,'list.elements.order[i].shippingInfo.postalAddress.postalCode');
    shippingInfoPostalAddressCountry := CkJsonObject__stringOf(jsonResponse,'list.elements.order[i].shippingInfo.postalAddress.country');
    shippingInfoPostalAddressAddressType := CkJsonObject__stringOf(jsonResponse,'list.elements.order[i].shippingInfo.postalAddress.addressType');
    shipNodeType := CkJsonObject__stringOf(jsonResponse,'list.elements.order[i].shipNode.type');
    j := 0;
    count_j := CkJsonObject_SizeOfArray(jsonResponse,'list.elements.order[i].orderLines.orderLine');
    while j < count_j do
      begin
        CkJsonObject_putJ(jsonResponse,j);
        lineNumber := CkJsonObject__stringOf(jsonResponse,'list.elements.order[i].orderLines.orderLine[j].lineNumber');
        itemProductName := CkJsonObject__stringOf(jsonResponse,'list.elements.order[i].orderLines.orderLine[j].item.productName');
        itemSku := CkJsonObject__stringOf(jsonResponse,'list.elements.order[i].orderLines.orderLine[j].item.sku');
        orderLineQuantityUnitOfMeasurement := CkJsonObject__stringOf(jsonResponse,'list.elements.order[i].orderLines.orderLine[j].orderLineQuantity.unitOfMeasurement');
        orderLineQuantityAmount := CkJsonObject__stringOf(jsonResponse,'list.elements.order[i].orderLines.orderLine[j].orderLineQuantity.amount');
        statusDate := CkJsonObject_IntOf(jsonResponse,'list.elements.order[i].orderLines.orderLine[j].statusDate');
        refund := CkJsonObject__stringOf(jsonResponse,'list.elements.order[i].orderLines.orderLine[j].refund');
        fulfillmentFulfillmentOption := CkJsonObject__stringOf(jsonResponse,'list.elements.order[i].orderLines.orderLine[j].fulfillment.fulfillmentOption');
        fulfillmentShipMethod := CkJsonObject__stringOf(jsonResponse,'list.elements.order[i].orderLines.orderLine[j].fulfillment.shipMethod');
        fulfillmentStoreId := CkJsonObject__stringOf(jsonResponse,'list.elements.order[i].orderLines.orderLine[j].fulfillment.storeId');
        fulfillmentPickUpDateTime := CkJsonObject_IntOf(jsonResponse,'list.elements.order[i].orderLines.orderLine[j].fulfillment.pickUpDateTime');
        fulfillmentPickUpBy := CkJsonObject__stringOf(jsonResponse,'list.elements.order[i].orderLines.orderLine[j].fulfillment.pickUpBy');
        fulfillmentShippingProgramType := CkJsonObject__stringOf(jsonResponse,'list.elements.order[i].orderLines.orderLine[j].fulfillment.shippingProgramType');
        k := 0;
        count_k := CkJsonObject_SizeOfArray(jsonResponse,'list.elements.order[i].orderLines.orderLine[j].charges.charge');
        while k < count_k do
          begin
            CkJsonObject_putK(jsonResponse,k);
            chargeType := CkJsonObject__stringOf(jsonResponse,'list.elements.order[i].orderLines.orderLine[j].charges.charge[k].chargeType');
            chargeName := CkJsonObject__stringOf(jsonResponse,'list.elements.order[i].orderLines.orderLine[j].charges.charge[k].chargeName');
            chargeAmountCurrency := CkJsonObject__stringOf(jsonResponse,'list.elements.order[i].orderLines.orderLine[j].charges.charge[k].chargeAmount.currency');
            chargeAmountAmount := CkJsonObject_IntOf(jsonResponse,'list.elements.order[i].orderLines.orderLine[j].charges.charge[k].chargeAmount.amount');
            taxTaxName := CkJsonObject__stringOf(jsonResponse,'list.elements.order[i].orderLines.orderLine[j].charges.charge[k].tax.taxName');
            taxTaxAmountCurrency := CkJsonObject__stringOf(jsonResponse,'list.elements.order[i].orderLines.orderLine[j].charges.charge[k].tax.taxAmount.currency');
            taxTaxAmountAmount := CkJsonObject__stringOf(jsonResponse,'list.elements.order[i].orderLines.orderLine[j].charges.charge[k].tax.taxAmount.amount');
            k := k + 1;
          end;

        k := 0;
        count_k := CkJsonObject_SizeOfArray(jsonResponse,'list.elements.order[i].orderLines.orderLine[j].orderLineStatuses.orderLineStatus');
        while k < count_k do
          begin
            CkJsonObject_putK(jsonResponse,k);
            status := CkJsonObject__stringOf(jsonResponse,'list.elements.order[i].orderLines.orderLine[j].orderLineStatuses.orderLineStatus[k].status');
            statusQuantityUnitOfMeasurement := CkJsonObject__stringOf(jsonResponse,'list.elements.order[i].orderLines.orderLine[j].orderLineStatuses.orderLineStatus[k].statusQuantity.unitOfMeasurement');
            statusQuantityAmount := CkJsonObject__stringOf(jsonResponse,'list.elements.order[i].orderLines.orderLine[j].orderLineStatuses.orderLineStatus[k].statusQuantity.amount');
            cancellationReason := CkJsonObject__stringOf(jsonResponse,'list.elements.order[i].orderLines.orderLine[j].orderLineStatuses.orderLineStatus[k].cancellationReason');
            trackingInfo := CkJsonObject__stringOf(jsonResponse,'list.elements.order[i].orderLines.orderLine[j].orderLineStatuses.orderLineStatus[k].trackingInfo');
            returnCenterAddress := CkJsonObject__stringOf(jsonResponse,'list.elements.order[i].orderLines.orderLine[j].orderLineStatuses.orderLineStatus[k].returnCenterAddress');
            k := k + 1;
          end;

        j := j + 1;
      end;

    i := i + 1;
  end;

CkHttp_Dispose(http);
CkHttpResponse_Dispose(resp);
CkJsonObject_Dispose(jsonResponse);