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
(PowerBuilder) 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
integer li_rc oleobject loo_Http integer li_Success oleobject loo_SbResponseBody oleobject loo_JResp integer li_RespStatusCode integer li_Id integer li_SortOrder string ls_Name integer j integer li_Count_j integer li_ProductId string ls_ProductCreatedAt string ls_ProductUpdatedAt integer li_ProductIsVisible string ls_ProductVisibility integer li_ProductHasMatrix string ls_ProductData01 string ls_ProductData02 string ls_ProductData03 string ls_ProductUrl string ls_ProductTitle string ls_ProductFulltitle string ls_ProductDescription string ls_ProductContent integer li_ProductSetId string ls_ProductSetCreatedAt string ls_ProductSetUpdatedAt string ls_ProductSetName integer li_ProductBrandResourceId string ls_ProductBrandResourceUrl string ls_ProductBrandResourceLink integer li_ProductCategoriesResourceId string ls_ProductCategoriesResourceUrl string ls_ProductCategoriesResourceLink integer li_ProductDeliverydateResourceId string ls_ProductDeliverydateResourceUrl string ls_ProductDeliverydateResourceLink string ls_ProductImageCreatedAt string ls_ProductImageUpdatedAt string ls_ProductImageExtension integer li_ProductImageSize string ls_ProductImageTitle string ls_ProductImageThumb string ls_ProductImageSrc integer li_ProductImagesResourceId string ls_ProductImagesResourceUrl string ls_ProductImagesResourceLink integer li_ProductRelationsResourceId string ls_ProductRelationsResourceUrl string ls_ProductRelationsResourceLink integer li_ProductMetafieldsResourceId string ls_ProductMetafieldsResourceUrl string ls_ProductMetafieldsResourceLink integer li_ProductReviewsResourceId string ls_ProductReviewsResourceUrl string ls_ProductReviewsResourceLink integer li_ProductType integer li_ProductAttributesResourceId string ls_ProductAttributesResourceUrl string ls_ProductAttributesResourceLink integer li_ProductSupplierResourceId string ls_ProductSupplierResourceUrl string ls_ProductSupplierResourceLink integer li_ProductTagsResourceId string ls_ProductTagsResourceUrl string ls_ProductTagsResourceLink integer li_ProductVariantsResourceId string ls_ProductVariantsResourceUrl string ls_ProductVariantsResourceLink integer li_ProductMovementsResourceId string ls_ProductMovementsResourceUrl string ls_ProductMovementsResourceLink integer i integer li_Count_i // This example assumes the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. loo_Http = create oleobject // Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0 li_rc = loo_Http.ConnectToNewObject("Chilkat.Http") if li_rc < 0 then destroy loo_Http MessageBox("Error","Connecting to COM object failed") return end if // 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 loo_Http.Login = "API_KEY" loo_Http.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/ loo_SbResponseBody = create oleobject // Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0 li_rc = loo_SbResponseBody.ConnectToNewObject("Chilkat.StringBuilder") li_Success = loo_Http.QuickGetSb("https://api.webshopapp.com/en/products.json",loo_SbResponseBody) if li_Success = 0 then Write-Debug loo_Http.LastErrorText destroy loo_Http destroy loo_SbResponseBody return end if loo_JResp = create oleobject // Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0 li_rc = loo_JResp.ConnectToNewObject("Chilkat.JsonObject") loo_JResp.LoadSb(loo_SbResponseBody) loo_JResp.EmitCompact = 0 Write-Debug "Response Body:" Write-Debug loo_JResp.Emit() li_RespStatusCode = loo_Http.LastStatus Write-Debug "Response Status Code = " + string(li_RespStatusCode) if li_RespStatusCode >= 400 then Write-Debug "Response Header:" Write-Debug loo_Http.LastHeader Write-Debug "Failed." destroy loo_Http destroy loo_SbResponseBody destroy loo_JResp return end if // 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 li_ProductId = loo_JResp.IntOf("product.id") ls_ProductCreatedAt = loo_JResp.StringOf("product.createdAt") ls_ProductUpdatedAt = loo_JResp.StringOf("product.updatedAt") li_ProductIsVisible = loo_JResp.BoolOf("product.isVisible") ls_ProductVisibility = loo_JResp.StringOf("product.visibility") li_ProductHasMatrix = loo_JResp.BoolOf("product.hasMatrix") ls_ProductData01 = loo_JResp.StringOf("product.data01") ls_ProductData02 = loo_JResp.StringOf("product.data02") ls_ProductData03 = loo_JResp.StringOf("product.data03") ls_ProductUrl = loo_JResp.StringOf("product.url") ls_ProductTitle = loo_JResp.StringOf("product.title") ls_ProductFulltitle = loo_JResp.StringOf("product.fulltitle") ls_ProductDescription = loo_JResp.StringOf("product.description") ls_ProductContent = loo_JResp.StringOf("product.content") li_ProductSetId = loo_JResp.IntOf("product.set.id") ls_ProductSetCreatedAt = loo_JResp.StringOf("product.set.createdAt") ls_ProductSetUpdatedAt = loo_JResp.StringOf("product.set.updatedAt") ls_ProductSetName = loo_JResp.StringOf("product.set.name") li_ProductBrandResourceId = loo_JResp.IntOf("product.brand.resource.id") ls_ProductBrandResourceUrl = loo_JResp.StringOf("product.brand.resource.url") ls_ProductBrandResourceLink = loo_JResp.StringOf("product.brand.resource.link") li_ProductCategoriesResourceId = loo_JResp.BoolOf("product.categories.resource.id") ls_ProductCategoriesResourceUrl = loo_JResp.StringOf("product.categories.resource.url") ls_ProductCategoriesResourceLink = loo_JResp.StringOf("product.categories.resource.link") li_ProductDeliverydateResourceId = loo_JResp.IntOf("product.deliverydate.resource.id") ls_ProductDeliverydateResourceUrl = loo_JResp.StringOf("product.deliverydate.resource.url") ls_ProductDeliverydateResourceLink = loo_JResp.StringOf("product.deliverydate.resource.link") ls_ProductImageCreatedAt = loo_JResp.StringOf("product.image.createdAt") ls_ProductImageUpdatedAt = loo_JResp.StringOf("product.image.updatedAt") ls_ProductImageExtension = loo_JResp.StringOf("product.image.extension") li_ProductImageSize = loo_JResp.IntOf("product.image.size") ls_ProductImageTitle = loo_JResp.StringOf("product.image.title") ls_ProductImageThumb = loo_JResp.StringOf("product.image.thumb") ls_ProductImageSrc = loo_JResp.StringOf("product.image.src") li_ProductImagesResourceId = loo_JResp.BoolOf("product.images.resource.id") ls_ProductImagesResourceUrl = loo_JResp.StringOf("product.images.resource.url") ls_ProductImagesResourceLink = loo_JResp.StringOf("product.images.resource.link") li_ProductRelationsResourceId = loo_JResp.BoolOf("product.relations.resource.id") ls_ProductRelationsResourceUrl = loo_JResp.StringOf("product.relations.resource.url") ls_ProductRelationsResourceLink = loo_JResp.StringOf("product.relations.resource.link") li_ProductMetafieldsResourceId = loo_JResp.BoolOf("product.metafields.resource.id") ls_ProductMetafieldsResourceUrl = loo_JResp.StringOf("product.metafields.resource.url") ls_ProductMetafieldsResourceLink = loo_JResp.StringOf("product.metafields.resource.link") li_ProductReviewsResourceId = loo_JResp.BoolOf("product.reviews.resource.id") ls_ProductReviewsResourceUrl = loo_JResp.StringOf("product.reviews.resource.url") ls_ProductReviewsResourceLink = loo_JResp.StringOf("product.reviews.resource.link") li_ProductType = loo_JResp.BoolOf("product.type") li_ProductAttributesResourceId = loo_JResp.BoolOf("product.attributes.resource.id") ls_ProductAttributesResourceUrl = loo_JResp.StringOf("product.attributes.resource.url") ls_ProductAttributesResourceLink = loo_JResp.StringOf("product.attributes.resource.link") li_ProductSupplierResourceId = loo_JResp.IntOf("product.supplier.resource.id") ls_ProductSupplierResourceUrl = loo_JResp.StringOf("product.supplier.resource.url") ls_ProductSupplierResourceLink = loo_JResp.StringOf("product.supplier.resource.link") li_ProductTagsResourceId = loo_JResp.BoolOf("product.tags.resource.id") ls_ProductTagsResourceUrl = loo_JResp.StringOf("product.tags.resource.url") ls_ProductTagsResourceLink = loo_JResp.StringOf("product.tags.resource.link") li_ProductVariantsResourceId = loo_JResp.BoolOf("product.variants.resource.id") ls_ProductVariantsResourceUrl = loo_JResp.StringOf("product.variants.resource.url") ls_ProductVariantsResourceLink = loo_JResp.StringOf("product.variants.resource.link") li_ProductMovementsResourceId = loo_JResp.BoolOf("product.movements.resource.id") ls_ProductMovementsResourceUrl = loo_JResp.StringOf("product.movements.resource.url") ls_ProductMovementsResourceLink = loo_JResp.StringOf("product.movements.resource.link") i = 0 li_Count_i = loo_JResp.SizeOfArray("product.set.options") do while i < li_Count_i loo_JResp.I = i li_Id = loo_JResp.IntOf("product.set.options[i].id") li_SortOrder = loo_JResp.IntOf("product.set.options[i].sortOrder") ls_Name = loo_JResp.StringOf("product.set.options[i].name") j = 0 li_Count_j = loo_JResp.SizeOfArray("product.set.options[i].values") do while j < li_Count_j loo_JResp.J = j li_Id = loo_JResp.IntOf("product.set.options[i].values[j].id") li_SortOrder = loo_JResp.IntOf("product.set.options[i].values[j].sortOrder") ls_Name = loo_JResp.StringOf("product.set.options[i].values[j].name") j = j + 1 loop i = i + 1 loop destroy loo_Http destroy loo_SbResponseBody destroy loo_JResp |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.