Chilkat Examples

ChilkatHOME.NET Core C#Android™AutoItCC#C++Chilkat2-PythonCkPythonClassic ASPDataFlexDelphi ActiveXDelphi DLLGoJavaLianjaMono C#Node.jsObjective-CPHP ActiveXPHP ExtensionPerlPowerBuilderPowerShellPureBasicRubySQL ServerSwift 2Swift 3,4,5...TclUnicode CUnicode C++VB.NETVBScriptVisual Basic 6.0Visual FoxProXojo Plugin

Node.js Web API Examples

Primary Categories

ABN AMRO
AWS Secrets Manager
AWS Security Token Service
AWS Translate
Activix CRM
Adyen
Alibaba Cloud OSS
Amazon Cognito
Amazon DynamoDB
Amazon MWS
Amazon Pay
Amazon Rekognition
Amazon SP-API
Amazon Voice ID
Aruba Fatturazione
Azure Maps
Azure Monitor
Azure OAuth2
Azure Storage Accounts
Backblaze S3
Banco Inter
Belgian eHealth Platform
Bitfinex v2 REST
Bluzone
BrickLink
Bunny CDN
CallRail
CardConnect
Cerved
ClickBank
Clickatell
Cloudfare
Constant Contact
DocuSign
Duo Auth MFA
ETrade
Ecwid
Egypt ITIDA
Egypt eReceipt
Etsy
Facebook
Faire
Frame.io
GeoOp
GetHarvest
Global Payments
Google People
Google Search Console
Google Translate
Google Vision
Hungary NAV Invoicing
IBM Text to Speech
Ibanity
IntakeQ
Jira
Lightspeed
MYOB
Magento
Mailgun
Malaysia MyInvois
Mastercard

MedTunnel
MercadoLibre
MessageMedia
Microsoft Calendar
Microsoft Group
Microsoft Tasks and Plans
Microsoft Teams
Moody's
Okta OAuth/OIDC
OneLogin OIDC
OneNote
OpenAI ChatGPT
PRODA
PayPal
Paynow.pl
Peoplevox
Populi
QuickBooks
Rabobank
Refinitiv
Royal Mail OBA
SCiS Schools Catalogue
SII Chile
SMSAPI
SOAP finkok.com
Salesforce
SendGrid
Shippo
Shopify
Shopware
Shopware 6
SimpleTexting
Square
Stripe
SugarCRM
TicketBAI
TikTok Shop
Trello
Twilio
Twitter API v2
Twitter v1
UPS
UniPin
VoiceBase
Vonage
WaTrend
Walmart v3
Wasabi
WhatsApp
WiX
WooCommerce
WordPress
Xero
Yahoo Mail
Yapily
Yousign
ZATCA
Zendesk
Zoom
_Miscellaneous_
eBay
effectconnect
hacienda.go.cr

 

 

 

(Node.js) Lightspeed - Get All Products

Retrieve a list of all product objects from this shop.

For more information, see https://developers.lightspeedhq.com/ecom/endpoints/product/#get-all-products

Install Chilkat for Node.js and Electron using npm at

Chilkat npm packages for Node.js

Chilkat npm packages for Electron

on Windows, Linux, MacOSX, and ARM

var os = require('os');
if (os.platform() == 'win32') {  
    if (os.arch() == 'ia32') {
        var chilkat = require('@chilkat/ck-node21-win-ia32');
    } else {
        var chilkat = require('@chilkat/ck-node21-win64'); 
    }
} else if (os.platform() == 'linux') {
    if (os.arch() == 'arm') {
        var chilkat = require('@chilkat/ck-node21-arm');
    } else if (os.arch() == 'x86') {
        var chilkat = require('@chilkat/ck-node21-linux32');
    } else {
        var chilkat = require('@chilkat/ck-node21-linux64');
    }
} else if (os.platform() == 'darwin') {
    if (os.arch() == 'arm64') {
        var chilkat = require('@chilkat/ck-node21-mac-m1');
    } else {
        var chilkat = require('@chilkat/ck-node21-macosx');
    }
}

function chilkatExample() {

    // This example assumes the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

    var http = new chilkat.Http();
    var success;

    // 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

    http.Login = "API_KEY";
    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/
    var sbResponseBody = new chilkat.StringBuilder();
    success = http.QuickGetSb("https://api.webshopapp.com/en/products.json",sbResponseBody);
    if (success == false) {
        console.log(http.LastErrorText);
        return;
    }

    var jResp = new chilkat.JsonObject();
    jResp.LoadSb(sbResponseBody);
    jResp.EmitCompact = false;

    console.log("Response Body:");
    console.log(jResp.Emit());

    var respStatusCode = http.LastStatus;
    console.log("Response Status Code = " + respStatusCode);
    if (respStatusCode >= 400) {
        console.log("Response Header:");
        console.log(http.LastHeader);
        console.log("Failed.");
        return;
    }

    // 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

    var id;
    var sortOrder;
    var name;
    var j;
    var count_j;

    var productId = jResp.IntOf("product.id");
    var productCreatedAt = jResp.StringOf("product.createdAt");
    var productUpdatedAt = jResp.StringOf("product.updatedAt");
    var productIsVisible = jResp.BoolOf("product.isVisible");
    var productVisibility = jResp.StringOf("product.visibility");
    var productHasMatrix = jResp.BoolOf("product.hasMatrix");
    var productData01 = jResp.StringOf("product.data01");
    var productData02 = jResp.StringOf("product.data02");
    var productData03 = jResp.StringOf("product.data03");
    var productUrl = jResp.StringOf("product.url");
    var productTitle = jResp.StringOf("product.title");
    var productFulltitle = jResp.StringOf("product.fulltitle");
    var productDescription = jResp.StringOf("product.description");
    var productContent = jResp.StringOf("product.content");
    var productSetId = jResp.IntOf("product.set.id");
    var productSetCreatedAt = jResp.StringOf("product.set.createdAt");
    var productSetUpdatedAt = jResp.StringOf("product.set.updatedAt");
    var productSetName = jResp.StringOf("product.set.name");
    var productBrandResourceId = jResp.IntOf("product.brand.resource.id");
    var productBrandResourceUrl = jResp.StringOf("product.brand.resource.url");
    var productBrandResourceLink = jResp.StringOf("product.brand.resource.link");
    var productCategoriesResourceId = jResp.BoolOf("product.categories.resource.id");
    var productCategoriesResourceUrl = jResp.StringOf("product.categories.resource.url");
    var productCategoriesResourceLink = jResp.StringOf("product.categories.resource.link");
    var productDeliverydateResourceId = jResp.IntOf("product.deliverydate.resource.id");
    var productDeliverydateResourceUrl = jResp.StringOf("product.deliverydate.resource.url");
    var productDeliverydateResourceLink = jResp.StringOf("product.deliverydate.resource.link");
    var productImageCreatedAt = jResp.StringOf("product.image.createdAt");
    var productImageUpdatedAt = jResp.StringOf("product.image.updatedAt");
    var productImageExtension = jResp.StringOf("product.image.extension");
    var productImageSize = jResp.IntOf("product.image.size");
    var productImageTitle = jResp.StringOf("product.image.title");
    var productImageThumb = jResp.StringOf("product.image.thumb");
    var productImageSrc = jResp.StringOf("product.image.src");
    var productImagesResourceId = jResp.BoolOf("product.images.resource.id");
    var productImagesResourceUrl = jResp.StringOf("product.images.resource.url");
    var productImagesResourceLink = jResp.StringOf("product.images.resource.link");
    var productRelationsResourceId = jResp.BoolOf("product.relations.resource.id");
    var productRelationsResourceUrl = jResp.StringOf("product.relations.resource.url");
    var productRelationsResourceLink = jResp.StringOf("product.relations.resource.link");
    var productMetafieldsResourceId = jResp.BoolOf("product.metafields.resource.id");
    var productMetafieldsResourceUrl = jResp.StringOf("product.metafields.resource.url");
    var productMetafieldsResourceLink = jResp.StringOf("product.metafields.resource.link");
    var productReviewsResourceId = jResp.BoolOf("product.reviews.resource.id");
    var productReviewsResourceUrl = jResp.StringOf("product.reviews.resource.url");
    var productReviewsResourceLink = jResp.StringOf("product.reviews.resource.link");
    var productType = jResp.BoolOf("product.type");
    var productAttributesResourceId = jResp.BoolOf("product.attributes.resource.id");
    var productAttributesResourceUrl = jResp.StringOf("product.attributes.resource.url");
    var productAttributesResourceLink = jResp.StringOf("product.attributes.resource.link");
    var productSupplierResourceId = jResp.IntOf("product.supplier.resource.id");
    var productSupplierResourceUrl = jResp.StringOf("product.supplier.resource.url");
    var productSupplierResourceLink = jResp.StringOf("product.supplier.resource.link");
    var productTagsResourceId = jResp.BoolOf("product.tags.resource.id");
    var productTagsResourceUrl = jResp.StringOf("product.tags.resource.url");
    var productTagsResourceLink = jResp.StringOf("product.tags.resource.link");
    var productVariantsResourceId = jResp.BoolOf("product.variants.resource.id");
    var productVariantsResourceUrl = jResp.StringOf("product.variants.resource.url");
    var productVariantsResourceLink = jResp.StringOf("product.variants.resource.link");
    var productMovementsResourceId = jResp.BoolOf("product.movements.resource.id");
    var productMovementsResourceUrl = jResp.StringOf("product.movements.resource.url");
    var productMovementsResourceLink = jResp.StringOf("product.movements.resource.link");
    var i = 0;
    var count_i = jResp.SizeOfArray("product.set.options");
    while (i < count_i) {
        jResp.I = i;
        id = jResp.IntOf("product.set.options[i].id");
        sortOrder = jResp.IntOf("product.set.options[i].sortOrder");
        name = jResp.StringOf("product.set.options[i].name");
        j = 0;
        count_j = jResp.SizeOfArray("product.set.options[i].values");
        while (j < count_j) {
            jResp.J = j;
            id = jResp.IntOf("product.set.options[i].values[j].id");
            sortOrder = jResp.IntOf("product.set.options[i].values[j].sortOrder");
            name = jResp.StringOf("product.set.options[i].values[j].name");
            j = j+1;
        }

        i = i+1;
    }


}

chilkatExample();

 

© 2000-2024 Chilkat Software, Inc. All Rights Reserved.