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

Walmart v3 Bulk Item Setup

See more Walmart v3 Examples

Updates items in bulk.

Chilkat Lua Downloads

Lua
local chilkat = require("chilkat")

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

local http = chilkat.Http.new()

-- Implements the following CURL command:

-- curl -X POST \
--   https://marketplace.walmartapis.com/v3/feeds?feedType=item \
--   -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: multipart/form-data'
--   -H 'Accept: application/xml'
--   -F feed=@qa_data/walmart/itemFeed.xml

local req = chilkat.HttpRequest.new()
req.http_verb = "POST"
req.path = "/v3/feeds?feedType=item"
req.content_type = "multipart/form-data"
local success = req:add_file_for_upload2("feed", "qa_data/walmart/itemFeed.xml", "application/xml")

req:add_header("WM_QOS.CORRELATION_ID", "b3261d2d-028a-4ef7-8602-633c23200af6")
req:add_header("Expect", "100-continue")
req:add_header("Content-Type", "multipart/form-data")
req:add_header("WM_SEC.ACCESS_TOKEN", "eyJraWQiOiIzZjVhYTFmNS1hYWE5LTQzM.....")
req:add_header("Accept", "application/xml")
req:add_header("WM_SVC.NAME", "Walmart Marketplace")

local resp = chilkat.HttpResponse.new()
success = http:http_sreq("marketplace.walmartapis.com", 443, true, req, resp)
if not success then
    print(http.last_error_text)
    return
end

local sbResponseBody = chilkat.StringBuilder.new()
resp:get_body_sb(sbResponseBody)

local xmlResponse = chilkat.Xml.new()
xmlResponse:load_sb(sbResponseBody, true)
print(xmlResponse:get_xml())

-- Sample XML response:
-- (Sample code for parsing the XML response is shown below)

-- <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-- <FeedAcknowledgement xmlns:ns2="http://walmart.com/">
--     <feedId>E9C04D1FFD99479FBC1341D56DD5F930@AQMB_wA</feedId>
-- </FeedAcknowledgement>

-- Sample code for parsing the XML response...
-- Use the following online tool to generate parsing code from sample XML:
-- Generate Parsing Code from XML

local FeedAcknowledgement_xmlns_ns2 = xmlResponse:get_attr_value("xmlns:ns2")
local feedId = xmlResponse:get_child_content("feedId")