Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(Unicode C) Walmart V3 API - Get All Released OrdersRetrieves all the orders with line items that are in the "created" status, that is, these orders have been released from the Walmart Order Management System to the seller for processing. The released orders are the orders that are ready for a seller to fulfill. For more information, see https://developer.walmart.com/#/apicenter/marketPlace/latest#getAllReleasedOrders
#include <C_CkHttpW.h> #include <C_CkHttpResponseW.h> #include <C_CkJsonObjectW.h> void ChilkatSample(void) { HCkHttpW http; HCkHttpResponseW resp; HCkJsonObjectW jsonResponse; const wchar_t *purchaseOrderId; const wchar_t *customerOrderId; const wchar_t *customerEmailId; int orderDate; const wchar_t *shippingInfoPhone; int shippingInfoEstimatedDeliveryDate; int shippingInfoEstimatedShipDate; const wchar_t *shippingInfoMethodCode; const wchar_t *shippingInfoPostalAddressName; const wchar_t *shippingInfoPostalAddressAddress1; const wchar_t *shippingInfoPostalAddressAddress2; const wchar_t *shippingInfoPostalAddressCity; const wchar_t *shippingInfoPostalAddressState; const wchar_t *shippingInfoPostalAddressPostalCode; const wchar_t *shippingInfoPostalAddressCountry; const wchar_t *shippingInfoPostalAddressAddressType; const wchar_t *shipNodeType; int j; int count_j; const wchar_t *lineNumber; const wchar_t *itemProductName; const wchar_t *itemSku; const wchar_t *orderLineQuantityUnitOfMeasurement; const wchar_t *orderLineQuantityAmount; int statusDate; const wchar_t *refund; const wchar_t *fulfillmentFulfillmentOption; const wchar_t *fulfillmentShipMethod; const wchar_t *fulfillmentStoreId; int fulfillmentPickUpDateTime; const wchar_t *fulfillmentPickUpBy; const wchar_t *fulfillmentShippingProgramType; int k; int count_k; const wchar_t *chargeType; const wchar_t *chargeName; const wchar_t *chargeAmountCurrency; int chargeAmountAmount; const wchar_t *taxTaxName; const wchar_t *taxTaxAmountCurrency; const wchar_t *taxTaxAmountAmount; const wchar_t *status; const wchar_t *statusQuantityUnitOfMeasurement; const wchar_t *statusQuantityAmount; const wchar_t *cancellationReason; const wchar_t *trackingInfo; const wchar_t *returnCenterAddress; int listMetaTotalCount; int listMetaLimit; const wchar_t *listMetaNextCursor; int i; int count_i; // This example requires the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. http = CkHttpW_Create(); CkHttpW_putAccept(http,L"application/json"); // Setting the Login and Password properties to the clientId and clientSecret // will cause the Basic Auth header to be added (i.e. BaseEncode64(clientId:clientSecret)) CkHttpW_putLogin(http,L"clientId"); CkHttpW_putPassword(http,L"clientSecret"); CkHttpW_putBasicAuth(http,TRUE); CkHttpW_SetRequestHeader(http,L"Content-Type",L"application/json"); CkHttpW_SetRequestHeader(http,L"WM_QOS.CORRELATION_ID",L"b3261d2d-028a-4ef7-8602-633c23200af6"); // Use the access token obtained from this example: Walmart v3 API Get OAuth2 Access Token using Client Credentials CkHttpW_SetRequestHeader(http,L"WM_SEC.ACCESS_TOKEN",L"eyJraWQiOiIzZjVhYTFmNS1hYWE5LTQzM....."); CkHttpW_SetRequestHeader(http,L"WM_SVC.NAME",L"Walmart Marketplace"); CkHttpW_SetUrlVar(http,L"createdStartDate",L"2020-01-16T10:30:15Z"); CkHttpW_SetUrlVar(http,L"limit",L"200"); // Can also be 3PLFulfilled CkHttpW_SetUrlVar(http,L"shippingProgramType",L"SellerFulfilled"); CkHttpW_SetUrlVar(http,L"shipNodeType",L"TWO_DAY"); resp = CkHttpW_QuickRequest(http,L"GET",L"/v3/orders/released?createdStartDate={$createdStartDate}&limit={$limit}&shippingProgramType={$shippingProgramType}&shipNodeType={$shipNodeType}"); if (CkHttpW_getLastMethodSuccess(http) != TRUE) { wprintf(L"%s\n",CkHttpW_lastErrorText(http)); CkHttpW_Dispose(http); return; } wprintf(L"Response Status Code: %d\n",CkHttpResponseW_getStatusCode(resp)); jsonResponse = CkJsonObjectW_Create(); CkJsonObjectW_Load(jsonResponse,CkHttpResponseW_bodyStr(resp)); CkJsonObjectW_putEmitCompact(jsonResponse,FALSE); wprintf(L"%s\n",CkJsonObjectW_emit(jsonResponse)); if (CkHttpResponseW_getStatusCode(resp) != 200) { wprintf(L"Failed.\n"); CkHttpResponseW_Dispose(resp); CkHttpW_Dispose(http); CkJsonObjectW_Dispose(jsonResponse); return; } CkHttpResponseW_Dispose(resp); // Sample output... // (See the parsing code below..) // // Use the this online tool to generate parsing code from sample JSON: // Generate Parsing Code from JSON // { // "list": { // "meta": { // "totalCount": 25228, // "limit": 10, // "nextCursor": "?limit=10&hasMoreElements=true&soIndex=25228&poIndex=10&sellerId=152&createdStartDate=2019-04-02T00:00:00.000Z&createdEndDate=2019-09-26T16:05:49.648Z" // }, // "elements": { // "order": [ // { // "purchaseOrderId": "4792701510371", // "customerOrderId": "5401973367419", // "customerEmailId": "47B81ACD2C62434DBE64F47B9E1F7630@relay.walmart.com", // "orderDate": 1569513584000, // "shippingInfo": { // "phone": "2134488377", // "estimatedDeliveryDate": 1569870000000, // "estimatedShipDate": 1569553200000, // "methodCode": "Express", // "postalAddress": { // "name": "Julio Hernandez", // "address1": "9713 pleasant view dr", // "address2": null, // "city": "Rancho Cucamonga", // "state": "CA", // "postalCode": "91701", // "country": "USA", // "addressType": "RESIDENTIAL" // } // }, // "orderLines": { // "orderLine": [ // { // "lineNumber": "1", // "item": { // "productName": "Refurbished Lenovo YB1-X90F Grey Yoga Book with WiFi 10.1\" Touchscreen Tablet Android 6.0.1", // "sku": "VO190403007727R" // }, // "charges": { // "charge": [ // { // "chargeType": "PRODUCT", // "chargeName": "ItemPrice", // "chargeAmount": { // "currency": "USD", // "amount": 259 // }, // "tax": { // "taxName": "Tax1", // "taxAmount": { // "currency": "USD", // "amount": 20.07 // } // } // }, // { // "chargeType": "FEE", // "chargeName": "Fee", // "chargeAmount": { // "currency": "USD", // "amount": 0 // }, // "tax": { // "taxName": "Electronic Waste Recycling Fee", // "taxAmount": { // "currency": "USD", // "amount": 5 // } // } // } // ] // }, // "orderLineQuantity": { // "unitOfMeasurement": "EACH", // "amount": "1" // }, // "statusDate": 1569513724000, // "orderLineStatuses": { // "orderLineStatus": [ // { // "status": "Acknowledged", // "statusQuantity": { // "unitOfMeasurement": "EACH", // "amount": "1" // }, // "cancellationReason": null, // "trackingInfo": null, // "returnCenterAddress": null // } // ] // }, // "refund": null, // "fulfillment": { // "fulfillmentOption": "S2H", // "shipMethod": "EXPEDITED", // "storeId": null, // "pickUpDateTime": 1569870000000, // "pickUpBy": null, // "shippingProgramType": "TWO_DAY" // } // } // ] // }, // "shipNode": { // "type": "3PLFulfilled" // } // } // ] // } // } // } // // Chilkat functions returning "const char *" return a pointer to temporary internal memory owned and managed by Chilkat. // See this example explaining how this memory should be used: const char * functions. listMetaTotalCount = CkJsonObjectW_IntOf(jsonResponse,L"list.meta.totalCount"); listMetaLimit = CkJsonObjectW_IntOf(jsonResponse,L"list.meta.limit"); listMetaNextCursor = CkJsonObjectW_stringOf(jsonResponse,L"list.meta.nextCursor"); i = 0; count_i = CkJsonObjectW_SizeOfArray(jsonResponse,L"list.elements.order"); while (i < count_i) { CkJsonObjectW_putI(jsonResponse,i); purchaseOrderId = CkJsonObjectW_stringOf(jsonResponse,L"list.elements.order[i].purchaseOrderId"); customerOrderId = CkJsonObjectW_stringOf(jsonResponse,L"list.elements.order[i].customerOrderId"); customerEmailId = CkJsonObjectW_stringOf(jsonResponse,L"list.elements.order[i].customerEmailId"); orderDate = CkJsonObjectW_IntOf(jsonResponse,L"list.elements.order[i].orderDate"); shippingInfoPhone = CkJsonObjectW_stringOf(jsonResponse,L"list.elements.order[i].shippingInfo.phone"); shippingInfoEstimatedDeliveryDate = CkJsonObjectW_IntOf(jsonResponse,L"list.elements.order[i].shippingInfo.estimatedDeliveryDate"); shippingInfoEstimatedShipDate = CkJsonObjectW_IntOf(jsonResponse,L"list.elements.order[i].shippingInfo.estimatedShipDate"); shippingInfoMethodCode = CkJsonObjectW_stringOf(jsonResponse,L"list.elements.order[i].shippingInfo.methodCode"); shippingInfoPostalAddressName = CkJsonObjectW_stringOf(jsonResponse,L"list.elements.order[i].shippingInfo.postalAddress.name"); shippingInfoPostalAddressAddress1 = CkJsonObjectW_stringOf(jsonResponse,L"list.elements.order[i].shippingInfo.postalAddress.address1"); shippingInfoPostalAddressAddress2 = CkJsonObjectW_stringOf(jsonResponse,L"list.elements.order[i].shippingInfo.postalAddress.address2"); shippingInfoPostalAddressCity = CkJsonObjectW_stringOf(jsonResponse,L"list.elements.order[i].shippingInfo.postalAddress.city"); shippingInfoPostalAddressState = CkJsonObjectW_stringOf(jsonResponse,L"list.elements.order[i].shippingInfo.postalAddress.state"); shippingInfoPostalAddressPostalCode = CkJsonObjectW_stringOf(jsonResponse,L"list.elements.order[i].shippingInfo.postalAddress.postalCode"); shippingInfoPostalAddressCountry = CkJsonObjectW_stringOf(jsonResponse,L"list.elements.order[i].shippingInfo.postalAddress.country"); shippingInfoPostalAddressAddressType = CkJsonObjectW_stringOf(jsonResponse,L"list.elements.order[i].shippingInfo.postalAddress.addressType"); shipNodeType = CkJsonObjectW_stringOf(jsonResponse,L"list.elements.order[i].shipNode.type"); j = 0; count_j = CkJsonObjectW_SizeOfArray(jsonResponse,L"list.elements.order[i].orderLines.orderLine"); while (j < count_j) { CkJsonObjectW_putJ(jsonResponse,j); lineNumber = CkJsonObjectW_stringOf(jsonResponse,L"list.elements.order[i].orderLines.orderLine[j].lineNumber"); itemProductName = CkJsonObjectW_stringOf(jsonResponse,L"list.elements.order[i].orderLines.orderLine[j].item.productName"); itemSku = CkJsonObjectW_stringOf(jsonResponse,L"list.elements.order[i].orderLines.orderLine[j].item.sku"); orderLineQuantityUnitOfMeasurement = CkJsonObjectW_stringOf(jsonResponse,L"list.elements.order[i].orderLines.orderLine[j].orderLineQuantity.unitOfMeasurement"); orderLineQuantityAmount = CkJsonObjectW_stringOf(jsonResponse,L"list.elements.order[i].orderLines.orderLine[j].orderLineQuantity.amount"); statusDate = CkJsonObjectW_IntOf(jsonResponse,L"list.elements.order[i].orderLines.orderLine[j].statusDate"); refund = CkJsonObjectW_stringOf(jsonResponse,L"list.elements.order[i].orderLines.orderLine[j].refund"); fulfillmentFulfillmentOption = CkJsonObjectW_stringOf(jsonResponse,L"list.elements.order[i].orderLines.orderLine[j].fulfillment.fulfillmentOption"); fulfillmentShipMethod = CkJsonObjectW_stringOf(jsonResponse,L"list.elements.order[i].orderLines.orderLine[j].fulfillment.shipMethod"); fulfillmentStoreId = CkJsonObjectW_stringOf(jsonResponse,L"list.elements.order[i].orderLines.orderLine[j].fulfillment.storeId"); fulfillmentPickUpDateTime = CkJsonObjectW_IntOf(jsonResponse,L"list.elements.order[i].orderLines.orderLine[j].fulfillment.pickUpDateTime"); fulfillmentPickUpBy = CkJsonObjectW_stringOf(jsonResponse,L"list.elements.order[i].orderLines.orderLine[j].fulfillment.pickUpBy"); fulfillmentShippingProgramType = CkJsonObjectW_stringOf(jsonResponse,L"list.elements.order[i].orderLines.orderLine[j].fulfillment.shippingProgramType"); k = 0; count_k = CkJsonObjectW_SizeOfArray(jsonResponse,L"list.elements.order[i].orderLines.orderLine[j].charges.charge"); while (k < count_k) { CkJsonObjectW_putK(jsonResponse,k); chargeType = CkJsonObjectW_stringOf(jsonResponse,L"list.elements.order[i].orderLines.orderLine[j].charges.charge[k].chargeType"); chargeName = CkJsonObjectW_stringOf(jsonResponse,L"list.elements.order[i].orderLines.orderLine[j].charges.charge[k].chargeName"); chargeAmountCurrency = CkJsonObjectW_stringOf(jsonResponse,L"list.elements.order[i].orderLines.orderLine[j].charges.charge[k].chargeAmount.currency"); chargeAmountAmount = CkJsonObjectW_IntOf(jsonResponse,L"list.elements.order[i].orderLines.orderLine[j].charges.charge[k].chargeAmount.amount"); taxTaxName = CkJsonObjectW_stringOf(jsonResponse,L"list.elements.order[i].orderLines.orderLine[j].charges.charge[k].tax.taxName"); taxTaxAmountCurrency = CkJsonObjectW_stringOf(jsonResponse,L"list.elements.order[i].orderLines.orderLine[j].charges.charge[k].tax.taxAmount.currency"); taxTaxAmountAmount = CkJsonObjectW_stringOf(jsonResponse,L"list.elements.order[i].orderLines.orderLine[j].charges.charge[k].tax.taxAmount.amount"); k = k + 1; } k = 0; count_k = CkJsonObjectW_SizeOfArray(jsonResponse,L"list.elements.order[i].orderLines.orderLine[j].orderLineStatuses.orderLineStatus"); while (k < count_k) { CkJsonObjectW_putK(jsonResponse,k); status = CkJsonObjectW_stringOf(jsonResponse,L"list.elements.order[i].orderLines.orderLine[j].orderLineStatuses.orderLineStatus[k].status"); statusQuantityUnitOfMeasurement = CkJsonObjectW_stringOf(jsonResponse,L"list.elements.order[i].orderLines.orderLine[j].orderLineStatuses.orderLineStatus[k].statusQuantity.unitOfMeasurement"); statusQuantityAmount = CkJsonObjectW_stringOf(jsonResponse,L"list.elements.order[i].orderLines.orderLine[j].orderLineStatuses.orderLineStatus[k].statusQuantity.amount"); cancellationReason = CkJsonObjectW_stringOf(jsonResponse,L"list.elements.order[i].orderLines.orderLine[j].orderLineStatuses.orderLineStatus[k].cancellationReason"); trackingInfo = CkJsonObjectW_stringOf(jsonResponse,L"list.elements.order[i].orderLines.orderLine[j].orderLineStatuses.orderLineStatus[k].trackingInfo"); returnCenterAddress = CkJsonObjectW_stringOf(jsonResponse,L"list.elements.order[i].orderLines.orderLine[j].orderLineStatuses.orderLineStatus[k].returnCenterAddress"); k = k + 1; } j = j + 1; } i = i + 1; } CkHttpW_Dispose(http); CkJsonObjectW_Dispose(jsonResponse); } |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.