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
(Visual FoxPro) WiX - Get all Products in a StoreGets the first page of products in a store. For more information, see https://dev.wix.com/api/rest/wix-stores/catalog/filter-and-sort
LOCAL loHttp LOCAL lnSuccess LOCAL loJson LOCAL loResp LOCAL loSbResponseBody LOCAL loJResp LOCAL lnRespStatusCode LOCAL lcId LOCAL lcName LOCAL lcSlug LOCAL lnVisible LOCAL lcProductType LOCAL lcDescription LOCAL lnStockTrackInventory LOCAL lnStockQuantity LOCAL lnStockInStock LOCAL lcPriceCurrency LOCAL lnPricePrice LOCAL lnPriceDiscountedPrice LOCAL lcPriceFormattedPrice LOCAL lcPriceFormattedDiscountedPrice LOCAL lcPriceDataCurrency LOCAL lnPriceDataPrice LOCAL lnPriceDataDiscountedPrice LOCAL lcPriceDataFormattedPrice LOCAL lcPriceDataFormattedDiscountedPrice LOCAL lnManageVariants LOCAL lcProductPageUrlBase LOCAL lcProductPageUrlPath LOCAL lcNumericId LOCAL lcInventoryItemId LOCAL lcDiscountType LOCAL lnDiscountValue LOCAL lcSku LOCAL lnWeight LOCAL j LOCAL lnCount_j LOCAL lcText LOCAL lcStrVal LOCAL lnMetadataItems LOCAL lnMetadataOffset LOCAL lnTotalResults LOCAL i LOCAL lnCount_i * This example assumes the Chilkat API to have been previously unlocked. * See Global Unlock Sample for sample code. * For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.Http') loHttp = CreateObject('Chilkat.Http') * Implements the following CURL command: * curl -X POST -H "Content-Type: application/json" \ * -d '{ * "includeVariants": true * }' https://www.wixapis.com/stores/v1/products/query * For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.JsonObject') loJson = CreateObject('Chilkat.JsonObject') loJson.UpdateBool("includeVariants",1) loHttp.AuthToken = "ACCESS_TOKEN" loHttp.SetRequestHeader("Content-Type","application/json") loResp = loHttp.PostJson3("https://www.wixapis.com/stores/v1/products/query","application/json",loJson) IF (loHttp.LastMethodSuccess = 0) THEN ? loHttp.LastErrorText RELEASE loHttp RELEASE loJson CANCEL ENDIF * For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.StringBuilder') loSbResponseBody = CreateObject('Chilkat.StringBuilder') loResp.GetBodySb(loSbResponseBody) * For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.JsonObject') loJResp = CreateObject('Chilkat.JsonObject') loJResp.LoadSb(loSbResponseBody) loJResp.EmitCompact = 0 ? "Response Body:" ? loJResp.Emit() lnRespStatusCode = loResp.StatusCode ? "Response Status Code = " + STR(lnRespStatusCode) IF (lnRespStatusCode >= 400) THEN ? "Response Header:" ? loResp.Header ? "Failed." RELEASE loResp RELEASE loHttp RELEASE loJson RELEASE loSbResponseBody RELEASE loJResp CANCEL ENDIF RELEASE loResp * Sample JSON response: * (Sample code for parsing the JSON response is shown below) * { * "products": [ * { * "id": "58fcbb51-ff87-08ff-d97b-646726676e4a", * "name": "webhook test", * "slug": "webhook-test", * "visible": true, * "productType": "physical", * "description": "<p>fasdf<\/p>", * "stock": { * "trackInventory": true, * "quantity": 0, * "inStock": false * }, * "price": { * "currency": "ILS", * "price": 234, * "discountedPrice": 234, * "formatted": { * "price": "234.00 ₪", * "discountedPrice": "234.00 ₪" * } * }, * "priceData": { * "currency": "ILS", * "price": 234, * "discountedPrice": 234, * "formatted": { * "price": "234.00 ₪", * "discountedPrice": "234.00 ₪" * } * }, * "additionalInfoSections": [ * ], * "ribbons": [ * { * "text": "ribby" * } * ], * "media": { * "items": [ * ] * }, * "customTextFields": [ * ], * "manageVariants": true, * "productOptions": [ * ], * "productPageUrl": { * "base": "https://www.my-website.com/", * "path": "/product-page/webhook-test" * }, * "numericId": "1567078000586000", * "inventoryItemId": "a70344ae-0078-f700-2684-9b98d99891b5", * "discount": { * "type": "NONE", * "value": 0 * }, * "collectionIds": [ * ], * "variants": [ * ] * }, * { * "id": "6507fd67-94e5-10af-73e4-d2167852d5bc", * "name": "digital product", * "slug": "digital-product", * "visible": true, * "productType": "digital", * "description": "", * "sku": "", * "weight": 0, * "stock": { * "trackInventory": false, * "inStock": true * }, * "price": { * "currency": "ILS", * "price": 123, * "discountedPrice": 123, * "formatted": { * "price": "123.00 ₪", * "discountedPrice": "123.00 ₪" * } * }, * "priceData": { * "currency": "ILS", * "price": 123, * "discountedPrice": 123, * "formatted": { * "price": "123.00 ₪", * "discountedPrice": "123.00 ₪" * } * }, * "additionalInfoSections": [ * ], * "ribbons": [ * ], * "media": { * "items": [ * ] * }, * "customTextFields": [ * ], * "manageVariants": false, * "productOptions": [ * ], * "productPageUrl": { * "base": "https://www.my-website.com/", * "path": "/product-page/digital-product" * }, * "numericId": "1544009414325000", * "inventoryItemId": "9af80298-6b1a-ef50-8c1b-2de987ad2a43", * "discount": { * "type": "NONE", * "value": 0 * }, * "collectionIds": [ * "ae886d55-2572-eee8-b2c4-13219844b5e4" * ], * "variants": [ * ] * } * ], * "metadata": { * "items": 100, * "offset": 0 * }, * "totalResults": 2 * } * Sample code for parsing the JSON response... * Use the following online tool to generate parsing code from sample JSON: * Generate Parsing Code from JSON lnMetadataItems = loJResp.IntOf("metadata.items") lnMetadataOffset = loJResp.IntOf("metadata.offset") lnTotalResults = loJResp.IntOf("totalResults") i = 0 lnCount_i = loJResp.SizeOfArray("products") DO WHILE i < lnCount_i loJResp.I = i lcId = loJResp.StringOf("products[i].id") lcName = loJResp.StringOf("products[i].name") lcSlug = loJResp.StringOf("products[i].slug") lnVisible = loJResp.BoolOf("products[i].visible") lcProductType = loJResp.StringOf("products[i].productType") lcDescription = loJResp.StringOf("products[i].description") lnStockTrackInventory = loJResp.BoolOf("products[i].stock.trackInventory") lnStockQuantity = loJResp.IntOf("products[i].stock.quantity") lnStockInStock = loJResp.BoolOf("products[i].stock.inStock") lcPriceCurrency = loJResp.StringOf("products[i].price.currency") lnPricePrice = loJResp.IntOf("products[i].price.price") lnPriceDiscountedPrice = loJResp.IntOf("products[i].price.discountedPrice") lcPriceFormattedPrice = loJResp.StringOf("products[i].price.formatted.price") lcPriceFormattedDiscountedPrice = loJResp.StringOf("products[i].price.formatted.discountedPrice") lcPriceDataCurrency = loJResp.StringOf("products[i].priceData.currency") lnPriceDataPrice = loJResp.IntOf("products[i].priceData.price") lnPriceDataDiscountedPrice = loJResp.IntOf("products[i].priceData.discountedPrice") lcPriceDataFormattedPrice = loJResp.StringOf("products[i].priceData.formatted.price") lcPriceDataFormattedDiscountedPrice = loJResp.StringOf("products[i].priceData.formatted.discountedPrice") lnManageVariants = loJResp.BoolOf("products[i].manageVariants") lcProductPageUrlBase = loJResp.StringOf("products[i].productPageUrl.base") lcProductPageUrlPath = loJResp.StringOf("products[i].productPageUrl.path") lcNumericId = loJResp.StringOf("products[i].numericId") lcInventoryItemId = loJResp.StringOf("products[i].inventoryItemId") lcDiscountType = loJResp.StringOf("products[i].discount.type") lnDiscountValue = loJResp.IntOf("products[i].discount.value") lcSku = loJResp.StringOf("products[i].sku") lnWeight = loJResp.IntOf("products[i].weight") j = 0 lnCount_j = loJResp.SizeOfArray("products[i].additionalInfoSections") DO WHILE j < lnCount_j loJResp.J = j j = j + 1 ENDDO j = 0 lnCount_j = loJResp.SizeOfArray("products[i].ribbons") DO WHILE j < lnCount_j loJResp.J = j lcText = loJResp.StringOf("products[i].ribbons[j].text") j = j + 1 ENDDO j = 0 lnCount_j = loJResp.SizeOfArray("products[i].media.items") DO WHILE j < lnCount_j loJResp.J = j j = j + 1 ENDDO j = 0 lnCount_j = loJResp.SizeOfArray("products[i].customTextFields") DO WHILE j < lnCount_j loJResp.J = j j = j + 1 ENDDO j = 0 lnCount_j = loJResp.SizeOfArray("products[i].productOptions") DO WHILE j < lnCount_j loJResp.J = j j = j + 1 ENDDO j = 0 lnCount_j = loJResp.SizeOfArray("products[i].collectionIds") DO WHILE j < lnCount_j loJResp.J = j lcStrVal = loJResp.StringOf("products[i].collectionIds[j]") j = j + 1 ENDDO j = 0 lnCount_j = loJResp.SizeOfArray("products[i].variants") DO WHILE j < lnCount_j loJResp.J = j j = j + 1 ENDDO i = i + 1 ENDDO RELEASE loHttp RELEASE loJson RELEASE loSbResponseBody RELEASE loJResp |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.