Rust
Rust
Walmart v3 Get a Feed Status
See more Walmart v3 Examples
This API returns the feed status for a specified Feed ID.Chilkat Rust Downloads
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
let http = chilkat::Http::new();
// Implements the following CURL command:
// curl -X GET \
// https://marketplace.walmartapis.com/v3/feeds/{feedId} \
// -H 'WM_SVC.NAME: Walmart Marketplace'
// -H 'WM_SEC.ACCESS_TOKEN: eyJraWQiOiIzZjVhYTFmNS1hYWE5LTQzM.....'
// -H 'WM_QOS.CORRELATION_ID: b3261d2d-028a-4ef7-8602-633c23200af6'
// -H 'Content-Type: application/xml'
// -H 'Accept: application/xml'
http.set_request_header("WM_QOS.CORRELATION_ID", "b3261d2d-028a-4ef7-8602-633c23200af6");
http.set_request_header("Content-Type", "application/xml");
http.set_request_header("WM_SEC.ACCESS_TOKEN", "eyJraWQiOiIzZjVhYTFmNS1hYWE5LTQzM.....");
http.set_request_header("Accept", "application/xml");
http.set_request_header("WM_SVC.NAME", "Walmart Marketplace");
let sb_response_body = chilkat::StringBuilder::new();
if http.quick_get_sb("https://marketplace.walmartapis.com/v3/feeds/{feedId}", &sb_response_body).is_err() {
println!("{}", http.last_error_text());
return;
}
let xml_response = chilkat::Xml::new();
let _ = xml_response.load_sb(&sb_response_body, true);
// Sample XML response:
// (Sample code for parsing the XML response is shown below)
// <?xml version="1.0" encoding="UTF-8"?>
// <PartnerFeedResponse xmlns:ns2="http://walmart.com/">
// <feedId>1c349f8f-aec0-411f-8454-ead47d12946f</feedId>
// <feedStatus>PROCESSED</feedStatus>
// <ingestionErrors/>
// <itemsReceived>11</itemsReceived>
// <itemsSucceeded>11</itemsSucceeded>
// <itemsFailed>0</itemsFailed>
// <itemsProcessing>0</itemsProcessing>
// <offset>0</offset>
// <limit>0</limit>
// <itemDetails>
// <itemIngestionStatus>
// <martId>0</martId>
// <sku>sku1</sku>
// <index>8</index>
// <ingestionStatus>SUCCESS</ingestionStatus>
// <ingestionErrors/>
// </itemIngestionStatus>
// <itemIngestionStatus>
// <martId>0</martId>
// <sku>sku2</sku>
// <index>6</index>
// <ingestionStatus>SUCCESS</ingestionStatus>
// <ingestionErrors/>
// </itemIngestionStatus>
// <itemIngestionStatus>
// <martId>0</martId>
// <sku>sku3</sku>
// <index>9</index>
// <ingestionStatus>SUCCESS</ingestionStatus>
// <ingestionErrors/>
// </itemIngestionStatus>
// </itemDetails>
// </PartnerFeedResponse>
// Sample code for parsing the XML response...
// Use the following online tool to generate parsing code from sample XML:
// Generate Parsing Code from XML
let mut i: i32 = 0;
let partner_feed_response_xmlns_ns2 = xml_response.get_attr_value("xmlns:ns2").unwrap_or_default();
let feed_id = xml_response.get_child_content("feedId").unwrap_or_default();
let feed_status = xml_response.get_child_content("feedStatus").unwrap_or_default();
let items_received = xml_response.get_child_int_value("itemsReceived");
let items_succeeded = xml_response.get_child_int_value("itemsSucceeded");
let items_failed = xml_response.get_child_int_value("itemsFailed");
let items_processing = xml_response.get_child_int_value("itemsProcessing");
let offset = xml_response.get_child_int_value("offset");
let limit = xml_response.get_child_int_value("limit");
i = 0;
let count_i = xml_response.num_children_having_tag("itemDetails|itemIngestionStatus");
while i < count_i {
xml_response.set_i(i);
let _ = xml_response.get_child_int_value("itemDetails|itemIngestionStatus[i]|martId");
let _ = xml_response.get_child_content("itemDetails|itemIngestionStatus[i]|sku").unwrap_or_default();
let _ = xml_response.get_child_int_value("itemDetails|itemIngestionStatus[i]|index");
let _ = xml_response.get_child_content("itemDetails|itemIngestionStatus[i]|ingestionStatus").unwrap_or_default();
i = i + 1;
}