DataFlex
DataFlex
Walmart v3 Get All Feed Statuses
See more Walmart v3 Examples
Returns the feed statuses for all the specified Feed IDs.Chilkat DataFlex Downloads
Use ChilkatAx-win32.pkg
Procedure Test
Boolean iSuccess
Handle hoHttp
Variant vSbResponseBody
Handle hoSbResponseBody
Handle hoXmlResponse
String sNs2_list_xmlns_ns2
Integer iNs2_totalResults
Integer iNs2_offset
Integer iNs2_limit
Integer i
Integer iCount_i
String sNs2_feedId
String sNs2_feedSource
String sNs2_feedType
Integer iNs2_partnerId
Integer iNs2_itemsReceived
Integer iNs2_itemsSucceeded
Integer iNs2_itemsFailed
Integer iNs2_itemsProcessing
String sNs2_feedStatus
String sNs2_feedDate
String sNs2_batchId
String sNs2_modifiedDtm
String sNs2_fileName
Integer iNs2_itemDataErrorCount
Integer iNs2_itemSystemErrorCount
Integer iNs2_itemTimeoutErrorCount
String sNs2_channelType
String sTemp1
Move False To iSuccess
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
Get Create (RefClass(cComChilkatHttp)) To hoHttp
If (Not(IsComObjectCreated(hoHttp))) Begin
Send CreateComObject of hoHttp
End
// 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'
Send ComSetRequestHeader To hoHttp "WM_QOS.CORRELATION_ID" "b3261d2d-028a-4ef7-8602-633c23200af6"
Send ComSetRequestHeader To hoHttp "Content-Type" "application/xml"
Send ComSetRequestHeader To hoHttp "WM_SEC.ACCESS_TOKEN" "eyJraWQiOiIzZjVhYTFmNS1hYWE5LTQzM....."
Send ComSetRequestHeader To hoHttp "Accept" "application/xml"
Send ComSetRequestHeader To hoHttp "WM_SVC.NAME" "Walmart Marketplace"
Get Create (RefClass(cComChilkatStringBuilder)) To hoSbResponseBody
If (Not(IsComObjectCreated(hoSbResponseBody))) Begin
Send CreateComObject of hoSbResponseBody
End
Get pvComObject of hoSbResponseBody to vSbResponseBody
Get ComQuickGetSb Of hoHttp "https://marketplace.walmartapis.com/v3/feeds?feedId={feedId}&limit={limit}&offset={offset}" vSbResponseBody To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoHttp To sTemp1
Showln sTemp1
Procedure_Return
End
Get Create (RefClass(cComChilkatXml)) To hoXmlResponse
If (Not(IsComObjectCreated(hoXmlResponse))) Begin
Send CreateComObject of hoXmlResponse
End
Get pvComObject of hoSbResponseBody to vSbResponseBody
Get ComLoadSb Of hoXmlResponse vSbResponseBody True To iSuccess
// 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
Get ComGetAttrValue Of hoXmlResponse "xmlns:ns2" To sNs2_list_xmlns_ns2
Get ComGetChildIntValue Of hoXmlResponse "ns2:totalResults" To iNs2_totalResults
Get ComGetChildIntValue Of hoXmlResponse "ns2:offset" To iNs2_offset
Get ComGetChildIntValue Of hoXmlResponse "ns2:limit" To iNs2_limit
Move 0 To i
Get ComNumChildrenHavingTag Of hoXmlResponse "ns2:results|ns2:feed" To iCount_i
While (i < iCount_i)
Set ComI Of hoXmlResponse To i
Get ComGetChildContent Of hoXmlResponse "ns2:results|ns2:feed[i]|ns2:feedId" To sNs2_feedId
Get ComGetChildContent Of hoXmlResponse "ns2:results|ns2:feed[i]|ns2:feedSource" To sNs2_feedSource
Get ComGetChildContent Of hoXmlResponse "ns2:results|ns2:feed[i]|ns2:feedType" To sNs2_feedType
Get ComGetChildIntValue Of hoXmlResponse "ns2:results|ns2:feed[i]|ns2:partnerId" To iNs2_partnerId
Get ComGetChildIntValue Of hoXmlResponse "ns2:results|ns2:feed[i]|ns2:itemsReceived" To iNs2_itemsReceived
Get ComGetChildIntValue Of hoXmlResponse "ns2:results|ns2:feed[i]|ns2:itemsSucceeded" To iNs2_itemsSucceeded
Get ComGetChildIntValue Of hoXmlResponse "ns2:results|ns2:feed[i]|ns2:itemsFailed" To iNs2_itemsFailed
Get ComGetChildIntValue Of hoXmlResponse "ns2:results|ns2:feed[i]|ns2:itemsProcessing" To iNs2_itemsProcessing
Get ComGetChildContent Of hoXmlResponse "ns2:results|ns2:feed[i]|ns2:feedStatus" To sNs2_feedStatus
Get ComGetChildContent Of hoXmlResponse "ns2:results|ns2:feed[i]|ns2:feedDate" To sNs2_feedDate
Get ComGetChildContent Of hoXmlResponse "ns2:results|ns2:feed[i]|ns2:batchId" To sNs2_batchId
Get ComGetChildContent Of hoXmlResponse "ns2:results|ns2:feed[i]|ns2:modifiedDtm" To sNs2_modifiedDtm
Get ComGetChildContent Of hoXmlResponse "ns2:results|ns2:feed[i]|ns2:fileName" To sNs2_fileName
Get ComGetChildIntValue Of hoXmlResponse "ns2:results|ns2:feed[i]|ns2:itemDataErrorCount" To iNs2_itemDataErrorCount
Get ComGetChildIntValue Of hoXmlResponse "ns2:results|ns2:feed[i]|ns2:itemSystemErrorCount" To iNs2_itemSystemErrorCount
Get ComGetChildIntValue Of hoXmlResponse "ns2:results|ns2:feed[i]|ns2:itemTimeoutErrorCount" To iNs2_itemTimeoutErrorCount
Get ComGetChildContent Of hoXmlResponse "ns2:results|ns2:feed[i]|ns2:channelType" To sNs2_channelType
Move (i + 1) To i
Loop
End_Procedure