Unicode C
Unicode C
Walmart v3 Get All Feed Statuses
See more Walmart v3 Examples
Returns the feed statuses for all the specified Feed IDs.Chilkat Unicode C Downloads
#include <C_CkHttpW.h>
#include <C_CkStringBuilderW.h>
#include <C_CkXmlW.h>
void ChilkatSample(void)
{
BOOL success;
HCkHttpW http;
HCkStringBuilderW sbResponseBody;
HCkXmlW xmlResponse;
const wchar_t *ns2_list_xmlns_ns2;
int ns2_totalResults;
int ns2_offset;
int ns2_limit;
int i;
int count_i;
const wchar_t *ns2_feedId;
const wchar_t *ns2_feedSource;
const wchar_t *ns2_feedType;
int ns2_partnerId;
int ns2_itemsReceived;
int ns2_itemsSucceeded;
int ns2_itemsFailed;
int ns2_itemsProcessing;
const wchar_t *ns2_feedStatus;
const wchar_t *ns2_feedDate;
const wchar_t *ns2_batchId;
const wchar_t *ns2_modifiedDtm;
const wchar_t *ns2_fileName;
int ns2_itemDataErrorCount;
int ns2_itemSystemErrorCount;
int ns2_itemTimeoutErrorCount;
const wchar_t *ns2_channelType;
success = FALSE;
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
http = CkHttpW_Create();
// 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'
CkHttpW_SetRequestHeader(http,L"WM_QOS.CORRELATION_ID",L"b3261d2d-028a-4ef7-8602-633c23200af6");
CkHttpW_SetRequestHeader(http,L"Content-Type",L"application/xml");
CkHttpW_SetRequestHeader(http,L"WM_SEC.ACCESS_TOKEN",L"eyJraWQiOiIzZjVhYTFmNS1hYWE5LTQzM.....");
CkHttpW_SetRequestHeader(http,L"Accept",L"application/xml");
CkHttpW_SetRequestHeader(http,L"WM_SVC.NAME",L"Walmart Marketplace");
sbResponseBody = CkStringBuilderW_Create();
success = CkHttpW_QuickGetSb(http,L"https://marketplace.walmartapis.com/v3/feeds?feedId={feedId}&limit={limit}&offset={offset}",sbResponseBody);
if (success == FALSE) {
wprintf(L"%s\n",CkHttpW_lastErrorText(http));
CkHttpW_Dispose(http);
CkStringBuilderW_Dispose(sbResponseBody);
return;
}
xmlResponse = CkXmlW_Create();
CkXmlW_LoadSb(xmlResponse,sbResponseBody,TRUE);
// 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 = CkXmlW_getAttrValue(xmlResponse,L"xmlns:ns2");
ns2_totalResults = CkXmlW_GetChildIntValue(xmlResponse,L"ns2:totalResults");
ns2_offset = CkXmlW_GetChildIntValue(xmlResponse,L"ns2:offset");
ns2_limit = CkXmlW_GetChildIntValue(xmlResponse,L"ns2:limit");
i = 0;
count_i = CkXmlW_NumChildrenHavingTag(xmlResponse,L"ns2:results|ns2:feed");
while (i < count_i) {
CkXmlW_putI(xmlResponse,i);
ns2_feedId = CkXmlW_getChildContent(xmlResponse,L"ns2:results|ns2:feed[i]|ns2:feedId");
ns2_feedSource = CkXmlW_getChildContent(xmlResponse,L"ns2:results|ns2:feed[i]|ns2:feedSource");
ns2_feedType = CkXmlW_getChildContent(xmlResponse,L"ns2:results|ns2:feed[i]|ns2:feedType");
ns2_partnerId = CkXmlW_GetChildIntValue(xmlResponse,L"ns2:results|ns2:feed[i]|ns2:partnerId");
ns2_itemsReceived = CkXmlW_GetChildIntValue(xmlResponse,L"ns2:results|ns2:feed[i]|ns2:itemsReceived");
ns2_itemsSucceeded = CkXmlW_GetChildIntValue(xmlResponse,L"ns2:results|ns2:feed[i]|ns2:itemsSucceeded");
ns2_itemsFailed = CkXmlW_GetChildIntValue(xmlResponse,L"ns2:results|ns2:feed[i]|ns2:itemsFailed");
ns2_itemsProcessing = CkXmlW_GetChildIntValue(xmlResponse,L"ns2:results|ns2:feed[i]|ns2:itemsProcessing");
ns2_feedStatus = CkXmlW_getChildContent(xmlResponse,L"ns2:results|ns2:feed[i]|ns2:feedStatus");
ns2_feedDate = CkXmlW_getChildContent(xmlResponse,L"ns2:results|ns2:feed[i]|ns2:feedDate");
ns2_batchId = CkXmlW_getChildContent(xmlResponse,L"ns2:results|ns2:feed[i]|ns2:batchId");
ns2_modifiedDtm = CkXmlW_getChildContent(xmlResponse,L"ns2:results|ns2:feed[i]|ns2:modifiedDtm");
ns2_fileName = CkXmlW_getChildContent(xmlResponse,L"ns2:results|ns2:feed[i]|ns2:fileName");
ns2_itemDataErrorCount = CkXmlW_GetChildIntValue(xmlResponse,L"ns2:results|ns2:feed[i]|ns2:itemDataErrorCount");
ns2_itemSystemErrorCount = CkXmlW_GetChildIntValue(xmlResponse,L"ns2:results|ns2:feed[i]|ns2:itemSystemErrorCount");
ns2_itemTimeoutErrorCount = CkXmlW_GetChildIntValue(xmlResponse,L"ns2:results|ns2:feed[i]|ns2:itemTimeoutErrorCount");
ns2_channelType = CkXmlW_getChildContent(xmlResponse,L"ns2:results|ns2:feed[i]|ns2:channelType");
i = i + 1;
}
CkHttpW_Dispose(http);
CkStringBuilderW_Dispose(sbResponseBody);
CkXmlW_Dispose(xmlResponse);
}