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) Lightspeed - Get All ProductsRetrieve a list of all product objects from this shop. For more information, see https://developers.lightspeedhq.com/ecom/endpoints/product/#get-all-products
LOCAL loHttp LOCAL lnSuccess LOCAL loSbResponseBody LOCAL loJResp LOCAL lnRespStatusCode LOCAL lnId LOCAL lnSortOrder LOCAL lcName LOCAL j LOCAL lnCount_j LOCAL lnProductId LOCAL lcProductCreatedAt LOCAL lcProductUpdatedAt LOCAL lnProductIsVisible LOCAL lcProductVisibility LOCAL lnProductHasMatrix LOCAL lcProductData01 LOCAL lcProductData02 LOCAL lcProductData03 LOCAL lcProductUrl LOCAL lcProductTitle LOCAL lcProductFulltitle LOCAL lcProductDescription LOCAL lcProductContent LOCAL lnProductSetId LOCAL lcProductSetCreatedAt LOCAL lcProductSetUpdatedAt LOCAL lcProductSetName LOCAL lnProductBrandResourceId LOCAL lcProductBrandResourceUrl LOCAL lcProductBrandResourceLink LOCAL lnProductCategoriesResourceId LOCAL lcProductCategoriesResourceUrl LOCAL lcProductCategoriesResourceLink LOCAL lnProductDeliverydateResourceId LOCAL lcProductDeliverydateResourceUrl LOCAL lcProductDeliverydateResourceLink LOCAL lcProductImageCreatedAt LOCAL lcProductImageUpdatedAt LOCAL lcProductImageExtension LOCAL lnProductImageSize LOCAL lcProductImageTitle LOCAL lcProductImageThumb LOCAL lcProductImageSrc LOCAL lnProductImagesResourceId LOCAL lcProductImagesResourceUrl LOCAL lcProductImagesResourceLink LOCAL lnProductRelationsResourceId LOCAL lcProductRelationsResourceUrl LOCAL lcProductRelationsResourceLink LOCAL lnProductMetafieldsResourceId LOCAL lcProductMetafieldsResourceUrl LOCAL lcProductMetafieldsResourceLink LOCAL lnProductReviewsResourceId LOCAL lcProductReviewsResourceUrl LOCAL lcProductReviewsResourceLink LOCAL lnProductType LOCAL lnProductAttributesResourceId LOCAL lcProductAttributesResourceUrl LOCAL lcProductAttributesResourceLink LOCAL lnProductSupplierResourceId LOCAL lcProductSupplierResourceUrl LOCAL lcProductSupplierResourceLink LOCAL lnProductTagsResourceId LOCAL lcProductTagsResourceUrl LOCAL lcProductTagsResourceLink LOCAL lnProductVariantsResourceId LOCAL lcProductVariantsResourceUrl LOCAL lcProductVariantsResourceLink LOCAL lnProductMovementsResourceId LOCAL lcProductMovementsResourceUrl LOCAL lcProductMovementsResourceLink 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 https://api.shoplightspeed.com/en/products.json \ * -u {key}:{secret} * Use the following online tool to generate HTTP code from a CURL command * Convert a cURL Command to HTTP Source Code loHttp.Login = "API_KEY" loHttp.Password = "API_SECRET" * Use the correct cluster for your shop. Here are the choices: * eu1 https://api.webshopapp.com/en/ * us1 https://api.shoplightspeed.com/en/ * For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.StringBuilder') loSbResponseBody = CreateObject('Chilkat.StringBuilder') lnSuccess = loHttp.QuickGetSb("https://api.webshopapp.com/en/products.json",loSbResponseBody) IF (lnSuccess = 0) THEN ? loHttp.LastErrorText RELEASE loHttp RELEASE loSbResponseBody CANCEL ENDIF * 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 = loHttp.LastStatus ? "Response Status Code = " + STR(lnRespStatusCode) IF (lnRespStatusCode >= 400) THEN ? "Response Header:" ? loHttp.LastHeader ? "Failed." RELEASE loHttp RELEASE loSbResponseBody RELEASE loJResp CANCEL ENDIF * Sample JSON response: * (Sample code for parsing the JSON response is shown below) * { * "product": { * "id": 20967267, * "createdAt": "2019-05-28T15:25:46+00:00", * "updatedAt": "2019-05-28T17:16:16+00:00", * "isVisible": true, * "visibility": "visible", * "hasMatrix": false, * "data01": "", * "data02": "", * "data03": "", * "url": "lookin-sharp-tee", * "title": "Lookin' Sharp T-Shirt", * "fulltitle": "Lookin' Sharp T-Shirt", * "description": "Description of the Lookin' Sharp T-Shirt", * "content": "<p>Long Description of the Lookin' Sharp T-Shirt</p>", * "set": { * "id": 2785, * "createdAt": "2019-05-28T15:32:12+00:00", * "updatedAt": "2019-05-28T15:42:59+00:00", * "name": "Shirts", * "options": [ * { * "id": 4626, * "sortOrder": 1, * "name": "Size", * "values": [ * { * "id": 14045, * "sortOrder": 1, * "name": "S" * }, * { * "id": 14046, * "sortOrder": 2, * "name": "M" * }, * { * "id": 14047, * "sortOrder": 3, * "name": "L" * } * ] * } * ] * }, * "brand": { * "resource": { * "id": 1171202, * "url": "brands/1171202", * "link": "https://api.shoplightspeed.com/us/brands/1171202.json" * } * }, * "categories": { * "resource": { * "id": false, * "url": "categories/products?product=20967267", * "link": "https://api.shoplightspeed.com/us/categories/products.json?product=20967267" * } * }, * "deliverydate": { * "resource": { * "id": 6488, * "url": "deliverydates/6488", * "link": "https://api.shoplightspeed.com/us/deliverydates/6488.json" * } * }, * "image": { * "createdAt": "2019-05-28T15:25:46+00:00", * "updatedAt": "2019-05-28T15:25:46+00:00", * "extension": "jpg", * "size": 86649, * "title": "17x35x-jcfk-88na-udwd-5hck-z63u-img-16-e0aa4f57-f4", * "thumb": "https://cdn.shoplightspeed.com/shops/000001/files/14119398/50x50x2/17x35x-jcfk-88na-udwd-5hck-z63u-img-16-e0aa4f57-f4.jpg", * "src": "https://cdn.shoplightspeed.com/shops/000001/files/14119398/17x35x-jcfk-88na-udwd-5hck-z63u-img-16-e0aa4f57-f4.jpg" * }, * "images": { * "resource": { * "id": false, * "url": "products/20967267/images", * "link": "https://api.shoplightspeed.com/us/products/20967267/images.json" * } * }, * "relations": { * "resource": { * "id": false, * "url": "products/20967267/relations", * "link": "https://api.shoplightspeed.com/us/products/20967267/relations.json" * } * }, * "metafields": { * "resource": { * "id": false, * "url": "products/20967267/metafields", * "link": "https://api.shoplightspeed.com/us/products/20967267/metafields.json" * } * }, * "reviews": { * "resource": { * "id": false, * "url": "reviews?product=20967267", * "link": "https://api.shoplightspeed.com/us/reviews.json?product=20967267" * } * }, * "type": false, * "attributes": { * "resource": { * "id": false, * "url": "products/20967267/attributes", * "link": "https://api.shoplightspeed.com/us/products/20967267/attributes.json" * } * }, * "supplier": { * "resource": { * "id": 78794, * "url": "suppliers/78794", * "link": "https://api.shoplightspeed.com/us/suppliers/78794.json" * } * }, * "tags": { * "resource": { * "id": false, * "url": "tags/products?product=20967267", * "link": "https://api.shoplightspeed.com/us/tags/products.json?product=20967267" * } * }, * "variants": { * "resource": { * "id": false, * "url": "variants?product=20967267", * "link": "https://api.shoplightspeed.com/us/variants.json?product=20967267" * } * }, * "movements": { * "resource": { * "id": false, * "url": "variants/movements?product=20967267", * "link": "https://api.shoplightspeed.com/us/variants/movements.json?product=20967267" * } * } * } * } * Sample code for parsing the JSON response... * Use the following online tool to generate parsing code from sample JSON: * Generate Parsing Code from JSON lnProductId = loJResp.IntOf("product.id") lcProductCreatedAt = loJResp.StringOf("product.createdAt") lcProductUpdatedAt = loJResp.StringOf("product.updatedAt") lnProductIsVisible = loJResp.BoolOf("product.isVisible") lcProductVisibility = loJResp.StringOf("product.visibility") lnProductHasMatrix = loJResp.BoolOf("product.hasMatrix") lcProductData01 = loJResp.StringOf("product.data01") lcProductData02 = loJResp.StringOf("product.data02") lcProductData03 = loJResp.StringOf("product.data03") lcProductUrl = loJResp.StringOf("product.url") lcProductTitle = loJResp.StringOf("product.title") lcProductFulltitle = loJResp.StringOf("product.fulltitle") lcProductDescription = loJResp.StringOf("product.description") lcProductContent = loJResp.StringOf("product.content") lnProductSetId = loJResp.IntOf("product.set.id") lcProductSetCreatedAt = loJResp.StringOf("product.set.createdAt") lcProductSetUpdatedAt = loJResp.StringOf("product.set.updatedAt") lcProductSetName = loJResp.StringOf("product.set.name") lnProductBrandResourceId = loJResp.IntOf("product.brand.resource.id") lcProductBrandResourceUrl = loJResp.StringOf("product.brand.resource.url") lcProductBrandResourceLink = loJResp.StringOf("product.brand.resource.link") lnProductCategoriesResourceId = loJResp.BoolOf("product.categories.resource.id") lcProductCategoriesResourceUrl = loJResp.StringOf("product.categories.resource.url") lcProductCategoriesResourceLink = loJResp.StringOf("product.categories.resource.link") lnProductDeliverydateResourceId = loJResp.IntOf("product.deliverydate.resource.id") lcProductDeliverydateResourceUrl = loJResp.StringOf("product.deliverydate.resource.url") lcProductDeliverydateResourceLink = loJResp.StringOf("product.deliverydate.resource.link") lcProductImageCreatedAt = loJResp.StringOf("product.image.createdAt") lcProductImageUpdatedAt = loJResp.StringOf("product.image.updatedAt") lcProductImageExtension = loJResp.StringOf("product.image.extension") lnProductImageSize = loJResp.IntOf("product.image.size") lcProductImageTitle = loJResp.StringOf("product.image.title") lcProductImageThumb = loJResp.StringOf("product.image.thumb") lcProductImageSrc = loJResp.StringOf("product.image.src") lnProductImagesResourceId = loJResp.BoolOf("product.images.resource.id") lcProductImagesResourceUrl = loJResp.StringOf("product.images.resource.url") lcProductImagesResourceLink = loJResp.StringOf("product.images.resource.link") lnProductRelationsResourceId = loJResp.BoolOf("product.relations.resource.id") lcProductRelationsResourceUrl = loJResp.StringOf("product.relations.resource.url") lcProductRelationsResourceLink = loJResp.StringOf("product.relations.resource.link") lnProductMetafieldsResourceId = loJResp.BoolOf("product.metafields.resource.id") lcProductMetafieldsResourceUrl = loJResp.StringOf("product.metafields.resource.url") lcProductMetafieldsResourceLink = loJResp.StringOf("product.metafields.resource.link") lnProductReviewsResourceId = loJResp.BoolOf("product.reviews.resource.id") lcProductReviewsResourceUrl = loJResp.StringOf("product.reviews.resource.url") lcProductReviewsResourceLink = loJResp.StringOf("product.reviews.resource.link") lnProductType = loJResp.BoolOf("product.type") lnProductAttributesResourceId = loJResp.BoolOf("product.attributes.resource.id") lcProductAttributesResourceUrl = loJResp.StringOf("product.attributes.resource.url") lcProductAttributesResourceLink = loJResp.StringOf("product.attributes.resource.link") lnProductSupplierResourceId = loJResp.IntOf("product.supplier.resource.id") lcProductSupplierResourceUrl = loJResp.StringOf("product.supplier.resource.url") lcProductSupplierResourceLink = loJResp.StringOf("product.supplier.resource.link") lnProductTagsResourceId = loJResp.BoolOf("product.tags.resource.id") lcProductTagsResourceUrl = loJResp.StringOf("product.tags.resource.url") lcProductTagsResourceLink = loJResp.StringOf("product.tags.resource.link") lnProductVariantsResourceId = loJResp.BoolOf("product.variants.resource.id") lcProductVariantsResourceUrl = loJResp.StringOf("product.variants.resource.url") lcProductVariantsResourceLink = loJResp.StringOf("product.variants.resource.link") lnProductMovementsResourceId = loJResp.BoolOf("product.movements.resource.id") lcProductMovementsResourceUrl = loJResp.StringOf("product.movements.resource.url") lcProductMovementsResourceLink = loJResp.StringOf("product.movements.resource.link") i = 0 lnCount_i = loJResp.SizeOfArray("product.set.options") DO WHILE i < lnCount_i loJResp.I = i lnId = loJResp.IntOf("product.set.options[i].id") lnSortOrder = loJResp.IntOf("product.set.options[i].sortOrder") lcName = loJResp.StringOf("product.set.options[i].name") j = 0 lnCount_j = loJResp.SizeOfArray("product.set.options[i].values") DO WHILE j < lnCount_j loJResp.J = j lnId = loJResp.IntOf("product.set.options[i].values[j].id") lnSortOrder = loJResp.IntOf("product.set.options[i].values[j].sortOrder") lcName = loJResp.StringOf("product.set.options[i].values[j].name") j = j + 1 ENDDO i = i + 1 ENDDO RELEASE loHttp RELEASE loSbResponseBody RELEASE loJResp |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.