PureBasic
PureBasic
Walmart v3 Get All Feed Statuses
See more Walmart v3 Examples
Returns the feed statuses for all the specified Feed IDs.Chilkat PureBasic Downloads
IncludeFile "CkHttp.pb"
IncludeFile "CkStringBuilder.pb"
IncludeFile "CkXml.pb"
Procedure ChilkatExample()
success.i = 0
; This example assumes the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
http.i = CkHttp::ckCreate()
If http.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
; Implements the following CURL command:
; curl -X GET \
; https://marketplace.walmartapis.com/v3/feeds?feedId={feedId}&limit={limit}&offset={offset} \
; -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'
CkHttp::ckSetRequestHeader(http,"WM_QOS.CORRELATION_ID","b3261d2d-028a-4ef7-8602-633c23200af6")
CkHttp::ckSetRequestHeader(http,"Content-Type","application/xml")
CkHttp::ckSetRequestHeader(http,"WM_SEC.ACCESS_TOKEN","eyJraWQiOiIzZjVhYTFmNS1hYWE5LTQzM.....")
CkHttp::ckSetRequestHeader(http,"Accept","application/xml")
CkHttp::ckSetRequestHeader(http,"WM_SVC.NAME","Walmart Marketplace")
sbResponseBody.i = CkStringBuilder::ckCreate()
If sbResponseBody.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
success = CkHttp::ckQuickGetSb(http,"https://marketplace.walmartapis.com/v3/feeds?feedId={feedId}&limit={limit}&offset={offset}",sbResponseBody)
If success = 0
Debug CkHttp::ckLastErrorText(http)
CkHttp::ckDispose(http)
CkStringBuilder::ckDispose(sbResponseBody)
ProcedureReturn
EndIf
xmlResponse.i = CkXml::ckCreate()
If xmlResponse.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
CkXml::ckLoadSb(xmlResponse,sbResponseBody,1)
; Sample XML response:
; (Sample code for parsing the XML response is shown below)
; <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
; <ns2:list xmlns:ns2="http://walmart.com/">
; <ns2:totalResults>2</ns2:totalResults>
; <ns2:offset>0</ns2:offset>
; <ns2:limit>50</ns2:limit>
; <ns2:results>
; <ns2:feed>
; <ns2:feedId>12234EGGT564YTEGFA@AQMBAQA</ns2:feedId>
; <ns2:feedSource>MARKETPLACE_PARTNER</ns2:feedSource>
; <ns2:feedType>item</ns2:feedType>
; <ns2:partnerId>1413254255</ns2:partnerId>
; <ns2:itemsReceived>1</ns2:itemsReceived>
; <ns2:itemsSucceeded>1</ns2:itemsSucceeded>
; <ns2:itemsFailed>0</ns2:itemsFailed>
; <ns2:itemsProcessing>0</ns2:itemsProcessing>
; <ns2:feedStatus>PROCESSED</ns2:feedStatus>
; <ns2:feedDate>2018-07-20T21:56:12.605Z</ns2:feedDate>
; <ns2:batchId>HP_REQUEST_BATCH</ns2:batchId>
; <ns2:modifiedDtm>2018-07-20T21:56:17.948Z</ns2:modifiedDtm>
; <ns2:fileName>ItemFeed99_ParadiseCounty_paperback.xml</ns2:fileName>
; <ns2:itemDataErrorCount>0</ns2:itemDataErrorCount>
; <ns2:itemSystemErrorCount>0</ns2:itemSystemErrorCount>
; <ns2:itemTimeoutErrorCount>0</ns2:itemTimeoutErrorCount>
; <ns2:channelType>WM_TEST</ns2:channelType>
; </ns2:feed>
; <ns2:feed>
; <ns2:feedId>12234EGGT564YTEGFA@AQMBAQA</ns2:feedId>
; <ns2:feedSource>MARKETPLACE_PARTNER</ns2:feedSource>
; <ns2:feedType>item</ns2:feedType>
; <ns2:partnerId>1413254255</ns2:partnerId>
; <ns2:itemsReceived>1</ns2:itemsReceived>
; <ns2:itemsSucceeded>1</ns2:itemsSucceeded>
; <ns2:itemsFailed>0</ns2:itemsFailed>
; <ns2:itemsProcessing>0</ns2:itemsProcessing>
; <ns2:feedStatus>PROCESSED</ns2:feedStatus>
; <ns2:feedDate>2018-07-20T21:56:12.605Z</ns2:feedDate>
; <ns2:batchId>HP_REQUEST_BATCH</ns2:batchId>
; <ns2:modifiedDtm>2018-07-20T21:56:17.948Z</ns2:modifiedDtm>
; <ns2:fileName>ItemFeed99_ParadiseCounty_paperback.xml</ns2:fileName>
; <ns2:itemDataErrorCount>0</ns2:itemDataErrorCount>
; <ns2:itemSystemErrorCount>0</ns2:itemSystemErrorCount>
; <ns2:itemTimeoutErrorCount>0</ns2:itemTimeoutErrorCount>
; <ns2:channelType>WM_TEST</ns2:channelType>
; </ns2:feed>
; </ns2:results>
; </ns2:list>
; Sample code for parsing the XML response...
; Use the following online tool to generate parsing code from sample XML:
; Generate Parsing Code from XML
ns2_list_xmlns_ns2.s
ns2_totalResults.i
ns2_offset.i
ns2_limit.i
i.i
count_i.i
ns2_feedId.s
ns2_feedSource.s
ns2_feedType.s
ns2_partnerId.i
ns2_itemsReceived.i
ns2_itemsSucceeded.i
ns2_itemsFailed.i
ns2_itemsProcessing.i
ns2_feedStatus.s
ns2_feedDate.s
ns2_batchId.s
ns2_modifiedDtm.s
ns2_fileName.s
ns2_itemDataErrorCount.i
ns2_itemSystemErrorCount.i
ns2_itemTimeoutErrorCount.i
ns2_channelType.s
ns2_list_xmlns_ns2 = CkXml::ckGetAttrValue(xmlResponse,"xmlns:ns2")
ns2_totalResults = CkXml::ckGetChildIntValue(xmlResponse,"ns2:totalResults")
ns2_offset = CkXml::ckGetChildIntValue(xmlResponse,"ns2:offset")
ns2_limit = CkXml::ckGetChildIntValue(xmlResponse,"ns2:limit")
i = 0
count_i = CkXml::ckNumChildrenHavingTag(xmlResponse,"ns2:results|ns2:feed")
While i < count_i
CkXml::setCkI(xmlResponse, i)
ns2_feedId = CkXml::ckGetChildContent(xmlResponse,"ns2:results|ns2:feed[i]|ns2:feedId")
ns2_feedSource = CkXml::ckGetChildContent(xmlResponse,"ns2:results|ns2:feed[i]|ns2:feedSource")
ns2_feedType = CkXml::ckGetChildContent(xmlResponse,"ns2:results|ns2:feed[i]|ns2:feedType")
ns2_partnerId = CkXml::ckGetChildIntValue(xmlResponse,"ns2:results|ns2:feed[i]|ns2:partnerId")
ns2_itemsReceived = CkXml::ckGetChildIntValue(xmlResponse,"ns2:results|ns2:feed[i]|ns2:itemsReceived")
ns2_itemsSucceeded = CkXml::ckGetChildIntValue(xmlResponse,"ns2:results|ns2:feed[i]|ns2:itemsSucceeded")
ns2_itemsFailed = CkXml::ckGetChildIntValue(xmlResponse,"ns2:results|ns2:feed[i]|ns2:itemsFailed")
ns2_itemsProcessing = CkXml::ckGetChildIntValue(xmlResponse,"ns2:results|ns2:feed[i]|ns2:itemsProcessing")
ns2_feedStatus = CkXml::ckGetChildContent(xmlResponse,"ns2:results|ns2:feed[i]|ns2:feedStatus")
ns2_feedDate = CkXml::ckGetChildContent(xmlResponse,"ns2:results|ns2:feed[i]|ns2:feedDate")
ns2_batchId = CkXml::ckGetChildContent(xmlResponse,"ns2:results|ns2:feed[i]|ns2:batchId")
ns2_modifiedDtm = CkXml::ckGetChildContent(xmlResponse,"ns2:results|ns2:feed[i]|ns2:modifiedDtm")
ns2_fileName = CkXml::ckGetChildContent(xmlResponse,"ns2:results|ns2:feed[i]|ns2:fileName")
ns2_itemDataErrorCount = CkXml::ckGetChildIntValue(xmlResponse,"ns2:results|ns2:feed[i]|ns2:itemDataErrorCount")
ns2_itemSystemErrorCount = CkXml::ckGetChildIntValue(xmlResponse,"ns2:results|ns2:feed[i]|ns2:itemSystemErrorCount")
ns2_itemTimeoutErrorCount = CkXml::ckGetChildIntValue(xmlResponse,"ns2:results|ns2:feed[i]|ns2:itemTimeoutErrorCount")
ns2_channelType = CkXml::ckGetChildContent(xmlResponse,"ns2:results|ns2:feed[i]|ns2:channelType")
i = i + 1
Wend
CkHttp::ckDispose(http)
CkStringBuilder::ckDispose(sbResponseBody)
CkXml::ckDispose(xmlResponse)
ProcedureReturn
EndProcedure