Rust Requires Chilkat v11.0.0+
Rust
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 Rust Downloads
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
let http = chilkat::Http::new();
http.set_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))
http.set_login("clientId");
http.set_password("clientSecret");
http.set_basic_auth(true);
http.set_request_header("Content-Type", "application/json");
http.set_request_header("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
http.set_request_header("WM_SEC.ACCESS_TOKEN", "eyJraWQiOiIzZjVhYTFmNS1hYWE5LTQzM.....");
http.set_request_header("WM_SVC.NAME", "Walmart Marketplace");
let _ = http.set_url_var("createdStartDate", "2020-01-16T10:30:15Z");
let _ = http.set_url_var("limit", "200");
// Can also be 3PLFulfilled
let _ = http.set_url_var("shippingProgramType", "SellerFulfilled");
let _ = http.set_url_var("shipNodeType", "TWO_DAY");
let resp = chilkat::HttpResponse::new();
if http.http_no_body("GET", "/v3/orders/released?createdStartDate={$createdStartDate}&limit={$limit}&shippingProgramType={$shippingProgramType}&shipNodeType={$shipNodeType}", &resp).is_err() {
println!("{}", http.last_error_text());
return;
}
println!("Response Status Code: {}", resp.status_code());
let json_response = chilkat::JsonObject::new();
let _ = json_response.load(&resp.body_str());
json_response.set_emit_compact(false);
println!("{}", json_response.emit().unwrap_or_default());
if resp.status_code() != 200 {
println!("Failed.");
return;
}
// 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"
// }
// }
// ]
// }
// }
// }
//
let mut j: i32 = 0;
let mut count_j: i32 = 0;
let mut k: i32 = 0;
let mut count_k: i32 = 0;
let list_meta_total_count = json_response.int_of("list.meta.totalCount");
let list_meta_limit = json_response.int_of("list.meta.limit");
let list_meta_next_cursor = json_response.string_of("list.meta.nextCursor").unwrap_or_default();
let mut i = 0;
let count_i = json_response.size_of_array("list.elements.order");
while i < count_i {
json_response.set_i(i);
let _ = json_response.string_of("list.elements.order[i].purchaseOrderId").unwrap_or_default();
let _ = json_response.string_of("list.elements.order[i].customerOrderId").unwrap_or_default();
let _ = json_response.string_of("list.elements.order[i].customerEmailId").unwrap_or_default();
let _ = json_response.int_of("list.elements.order[i].orderDate");
let _ = json_response.string_of("list.elements.order[i].shippingInfo.phone").unwrap_or_default();
let _ = json_response.int_of("list.elements.order[i].shippingInfo.estimatedDeliveryDate");
let _ = json_response.int_of("list.elements.order[i].shippingInfo.estimatedShipDate");
let _ = json_response.string_of("list.elements.order[i].shippingInfo.methodCode").unwrap_or_default();
let _ = json_response.string_of("list.elements.order[i].shippingInfo.postalAddress.name").unwrap_or_default();
let _ = json_response.string_of("list.elements.order[i].shippingInfo.postalAddress.address1").unwrap_or_default();
let _ = json_response.string_of("list.elements.order[i].shippingInfo.postalAddress.address2").unwrap_or_default();
let _ = json_response.string_of("list.elements.order[i].shippingInfo.postalAddress.city").unwrap_or_default();
let _ = json_response.string_of("list.elements.order[i].shippingInfo.postalAddress.state").unwrap_or_default();
let _ = json_response.string_of("list.elements.order[i].shippingInfo.postalAddress.postalCode").unwrap_or_default();
let _ = json_response.string_of("list.elements.order[i].shippingInfo.postalAddress.country").unwrap_or_default();
let _ = json_response.string_of("list.elements.order[i].shippingInfo.postalAddress.addressType").unwrap_or_default();
let _ = json_response.string_of("list.elements.order[i].shipNode.type").unwrap_or_default();
j = 0;
count_j = json_response.size_of_array("list.elements.order[i].orderLines.orderLine");
while j < count_j {
json_response.set_j(j);
let _ = json_response.string_of("list.elements.order[i].orderLines.orderLine[j].lineNumber").unwrap_or_default();
let _ = json_response.string_of("list.elements.order[i].orderLines.orderLine[j].item.productName").unwrap_or_default();
let _ = json_response.string_of("list.elements.order[i].orderLines.orderLine[j].item.sku").unwrap_or_default();
let _ = json_response.string_of("list.elements.order[i].orderLines.orderLine[j].orderLineQuantity.unitOfMeasurement").unwrap_or_default();
let _ = json_response.string_of("list.elements.order[i].orderLines.orderLine[j].orderLineQuantity.amount").unwrap_or_default();
let _ = json_response.int_of("list.elements.order[i].orderLines.orderLine[j].statusDate");
let _ = json_response.string_of("list.elements.order[i].orderLines.orderLine[j].refund").unwrap_or_default();
let _ = json_response.string_of("list.elements.order[i].orderLines.orderLine[j].fulfillment.fulfillmentOption").unwrap_or_default();
let _ = json_response.string_of("list.elements.order[i].orderLines.orderLine[j].fulfillment.shipMethod").unwrap_or_default();
let _ = json_response.string_of("list.elements.order[i].orderLines.orderLine[j].fulfillment.storeId").unwrap_or_default();
let _ = json_response.int_of("list.elements.order[i].orderLines.orderLine[j].fulfillment.pickUpDateTime");
let _ = json_response.string_of("list.elements.order[i].orderLines.orderLine[j].fulfillment.pickUpBy").unwrap_or_default();
let _ = json_response.string_of("list.elements.order[i].orderLines.orderLine[j].fulfillment.shippingProgramType").unwrap_or_default();
k = 0;
count_k = json_response.size_of_array("list.elements.order[i].orderLines.orderLine[j].charges.charge");
while k < count_k {
json_response.set_k(k);
let _ = json_response.string_of("list.elements.order[i].orderLines.orderLine[j].charges.charge[k].chargeType").unwrap_or_default();
let _ = json_response.string_of("list.elements.order[i].orderLines.orderLine[j].charges.charge[k].chargeName").unwrap_or_default();
let _ = json_response.string_of("list.elements.order[i].orderLines.orderLine[j].charges.charge[k].chargeAmount.currency").unwrap_or_default();
let _ = json_response.int_of("list.elements.order[i].orderLines.orderLine[j].charges.charge[k].chargeAmount.amount");
let _ = json_response.string_of("list.elements.order[i].orderLines.orderLine[j].charges.charge[k].tax.taxName").unwrap_or_default();
let _ = json_response.string_of("list.elements.order[i].orderLines.orderLine[j].charges.charge[k].tax.taxAmount.currency").unwrap_or_default();
let _ = json_response.string_of("list.elements.order[i].orderLines.orderLine[j].charges.charge[k].tax.taxAmount.amount").unwrap_or_default();
k = k + 1;
}
k = 0;
count_k = json_response.size_of_array("list.elements.order[i].orderLines.orderLine[j].orderLineStatuses.orderLineStatus");
while k < count_k {
json_response.set_k(k);
let _ = json_response.string_of("list.elements.order[i].orderLines.orderLine[j].orderLineStatuses.orderLineStatus[k].status").unwrap_or_default();
let _ = json_response.string_of("list.elements.order[i].orderLines.orderLine[j].orderLineStatuses.orderLineStatus[k].statusQuantity.unitOfMeasurement").unwrap_or_default();
let _ = json_response.string_of("list.elements.order[i].orderLines.orderLine[j].orderLineStatuses.orderLineStatus[k].statusQuantity.amount").unwrap_or_default();
let _ = json_response.string_of("list.elements.order[i].orderLines.orderLine[j].orderLineStatuses.orderLineStatus[k].cancellationReason").unwrap_or_default();
let _ = json_response.string_of("list.elements.order[i].orderLines.orderLine[j].orderLineStatuses.orderLineStatus[k].trackingInfo").unwrap_or_default();
let _ = json_response.string_of("list.elements.order[i].orderLines.orderLine[j].orderLineStatuses.orderLineStatus[k].returnCenterAddress").unwrap_or_default();
k = k + 1;
}
j = j + 1;
}
i = i + 1;
}