Sample code for 30+ languages & platforms
SQL Server

WooCommerce List All Products

See more WooCommerce Examples

Gets WooCommerce product information in JSON format.

Chilkat SQL Server Downloads

SQL Server
-- Important: See this note about string length limitations for strings returned by sp_OAMethod calls.
--
CREATE PROCEDURE ChilkatSample
AS
BEGIN
    DECLARE @hr int
    -- Important: Do not use nvarchar(max).  See the warning about using nvarchar(max).
    DECLARE @sTmp0 nvarchar(4000)
    DECLARE @success int
    SELECT @success = 0

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

    DECLARE @http int
    EXEC @hr = sp_OACreate 'Chilkat.Http', @http OUT
    IF @hr <> 0
    BEGIN
        PRINT 'Failed to create ActiveX component'
        RETURN
    END

    -- Implements the following CURL command:

    -- curl https://example.com/wp-json/wc/v3/products \
    --     -u consumer_key:consumer_secret

    -- Use the following online tool to generate HTTP code from a CURL command
    -- Convert a cURL Command to HTTP Source Code

    EXEC sp_OASetProperty @http, 'BasicAuth', 1
    EXEC sp_OASetProperty @http, 'Login', 'consumer_key'
    EXEC sp_OASetProperty @http, 'Password', 'consumer_secret'

    DECLARE @sbResponseBody int
    EXEC @hr = sp_OACreate 'Chilkat.StringBuilder', @sbResponseBody OUT

    EXEC sp_OAMethod @http, 'QuickGetSb', @success OUT, 'https://example.com/wp-json/wc/v3/products', @sbResponseBody
    IF @success = 0
      BEGIN
        EXEC sp_OAGetProperty @http, 'LastErrorText', @sTmp0 OUT
        PRINT @sTmp0
        EXEC @hr = sp_OADestroy @http
        EXEC @hr = sp_OADestroy @sbResponseBody
        RETURN
      END

    DECLARE @jarrResp int
    EXEC @hr = sp_OACreate 'Chilkat.JsonArray', @jarrResp OUT

    EXEC sp_OAMethod @jarrResp, 'LoadSb', @success OUT, @sbResponseBody
    EXEC sp_OASetProperty @jarrResp, 'EmitCompact', 0


    PRINT 'Response Body:'
    EXEC sp_OAMethod @jarrResp, 'Emit', @sTmp0 OUT
    PRINT @sTmp0

    DECLARE @respStatusCode int
    EXEC sp_OAGetProperty @http, 'LastStatus', @respStatusCode OUT

    PRINT 'Response Status Code = ' + @respStatusCode
    IF @respStatusCode >= 400
      BEGIN

        PRINT 'Response Header:'
        EXEC sp_OAGetProperty @http, 'LastHeader', @sTmp0 OUT
        PRINT @sTmp0

        PRINT 'Failed.'
        EXEC @hr = sp_OADestroy @http
        EXEC @hr = sp_OADestroy @sbResponseBody
        EXEC @hr = sp_OADestroy @jarrResp
        RETURN
      END

    -- Sample JSON response:
    -- (Sample code for parsing the JSON response is shown below)

    -- [
    --   {
    --     "id": 799,
    --     "name": "Ship Your Idea",
    --     "slug": "ship-your-idea-22",
    --     "permalink": "https://example.com/product/ship-your-idea-22/",
    --     "date_created": "2017-03-23T17:03:12",
    --     "date_created_gmt": "2017-03-23T20:03:12",
    --     "date_modified": "2017-03-23T17:03:12",
    --     "date_modified_gmt": "2017-03-23T20:03:12",
    --     "type": "variable",
    --     "status": "publish",
    --     "featured": false,
    --     "catalog_visibility": "visible",
    --     "description": "<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>\n",
    --     "short_description": "<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p>\n",
    --     "sku": "",
    --     "price": "",
    --     "regular_price": "",
    --     "sale_price": "",
    --     "date_on_sale_from": null,
    --     "date_on_sale_from_gmt": null,
    --     "date_on_sale_to": null,
    --     "date_on_sale_to_gmt": null,
    --     "price_html": "",
    --     "on_sale": false,
    --     "purchasable": false,
    --     "total_sales": 0,
    --     "virtual": false,
    --     "downloadable": false,
    --     "downloads": [
    --     ],
    --     "download_limit": -1,
    --     "download_expiry": -1,
    --     "external_url": "",
    --     "button_text": "",
    --     "tax_status": "taxable",
    --     "tax_class": "",
    --     "manage_stock": false,
    --     "stock_quantity": null,
    --     "stock_status": "instock",
    --     "backorders": "no",
    --     "backorders_allowed": false,
    --     "backordered": false,
    --     "sold_individually": false,
    --     "weight": "",
    --     "dimensions": {
    --       "length": "",
    --       "width": "",
    --       "height": ""
    --     },
    --     "shipping_required": true,
    --     "shipping_taxable": true,
    --     "shipping_class": "",
    --     "shipping_class_id": 0,
    --     "reviews_allowed": true,
    --     "average_rating": "0.00",
    --     "rating_count": 0,
    --     "related_ids": [
    --       31,
    --       22,
    --       369,
    --       414,
    --       56
    --     ],
    --     "upsell_ids": [
    --     ],
    --     "cross_sell_ids": [
    --     ],
    --     "parent_id": 0,
    --     "purchase_note": "",
    --     "categories": [
    --       {
    --         "id": 9,
    --         "name": "Clothing",
    --         "slug": "clothing"
    --       },
    --       {
    --         "id": 14,
    --         "name": "T-shirts",
    --         "slug": "t-shirts"
    --       }
    --     ],
    --     "tags": [
    --     ],
    --     "images": [
    --       {
    --         "id": 795,
    --         "date_created": "2017-03-23T14:03:08",
    --         "date_created_gmt": "2017-03-23T20:03:08",
    --         "date_modified": "2017-03-23T14:03:08",
    --         "date_modified_gmt": "2017-03-23T20:03:08",
    --         "src": "https://example.com/wp-content/uploads/2017/03/T_4_front-11.jpg",
    --         "name": "",
    --         "alt": ""
    --       },
    --       {
    --         "id": 796,
    --         "date_created": "2017-03-23T14:03:09",
    --         "date_created_gmt": "2017-03-23T20:03:09",
    --         "date_modified": "2017-03-23T14:03:09",
    --         "date_modified_gmt": "2017-03-23T20:03:09",
    --         "src": "https://example.com/wp-content/uploads/2017/03/T_4_back-10.jpg",
    --         "name": "",
    --         "alt": ""
    --       },
    --       {
    --         "id": 797,
    --         "date_created": "2017-03-23T14:03:10",
    --         "date_created_gmt": "2017-03-23T20:03:10",
    --         "date_modified": "2017-03-23T14:03:10",
    --         "date_modified_gmt": "2017-03-23T20:03:10",
    --         "src": "https://example.com/wp-content/uploads/2017/03/T_3_front-10.jpg",
    --         "name": "",
    --         "alt": ""
    --       },
    --       {
    --         "id": 798,
    --         "date_created": "2017-03-23T14:03:11",
    --         "date_created_gmt": "2017-03-23T20:03:11",
    --         "date_modified": "2017-03-23T14:03:11",
    --         "date_modified_gmt": "2017-03-23T20:03:11",
    --         "src": "https://example.com/wp-content/uploads/2017/03/T_3_back-10.jpg",
    --         "name": "",
    --         "alt": ""
    --       }
    --     ],
    --     "attributes": [
    --       {
    --         "id": 6,
    --         "name": "Color",
    --         "position": 0,
    --         "visible": false,
    --         "variation": true,
    --         "options": [
    --           "Black",
    --           "Green"
    --         ]
    --       },
    --       {
    --         "id": 0,
    --         "name": "Size",
    --         "position": 0,
    --         "visible": true,
    --         "variation": true,
    --         "options": [
    --           "S",
    --           "M"
    --         ]
    --       }
    --     ],
    --     "default_attributes": [
    --     ],
    --     "variations": [
    --     ],
    --     "grouped_products": [
    --     ],
    --     "menu_order": 0,
    --     "meta_data": [
    --     ],
    --     "_links": {
    --       "self": [
    --         {
    --           "href": "https://example.com/wp-json/wc/v3/products/799"
    --         }
    --       ],
    --       "collection": [
    --         {
    --           "href": "https://example.com/wp-json/wc/v3/products"
    --         }
    --       ]
    --     }
    --   },
    --   {
    --     "id": 794,
    --     "name": "Premium Quality",
    --     "slug": "premium-quality-19",
    --     "permalink": "https://example.com/product/premium-quality-19/",
    --     "date_created": "2017-03-23T17:01:14",
    --     "date_created_gmt": "2017-03-23T20:01:14",
    --     "date_modified": "2017-03-23T17:01:14",
    --     "date_modified_gmt": "2017-03-23T20:01:14",
    --     "type": "simple",
    --     "status": "publish",
    --     "featured": false,
    --     "catalog_visibility": "visible",
    --     "description": "<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>\n",
    --     "short_description": "<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p>\n",
    --     "sku": "",
    --     "price": "21.99",
    --     "regular_price": "21.99",
    --     "sale_price": "",
    --     "date_on_sale_from": null,
    --     "date_on_sale_from_gmt": null,
    --     "date_on_sale_to": null,
    --     "date_on_sale_to_gmt": null,
    --     "price_html": "<span class=\"woocommerce-Price-amount amount\"><span class=\"woocommerce-Price-currencySymbol\">&#36;</span>21.99</span>",
    --     "on_sale": false,
    --     "purchasable": true,
    --     "total_sales": 0,
    --     "virtual": false,
    --     "downloadable": false,
    --     "downloads": [
    --     ],
    --     "download_limit": -1,
    --     "download_expiry": -1,
    --     "external_url": "",
    --     "button_text": "",
    --     "tax_status": "taxable",
    --     "tax_class": "",
    --     "manage_stock": false,
    --     "stock_quantity": null,
    --     "stock_status": "instock",
    --     "backorders": "no",
    --     "backorders_allowed": false,
    --     "backordered": false,
    --     "sold_individually": false,
    --     "weight": "",
    --     "dimensions": {
    --       "length": "",
    --       "width": "",
    --       "height": ""
    --     },
    --     "shipping_required": true,
    --     "shipping_taxable": true,
    --     "shipping_class": "",
    --     "shipping_class_id": 0,
    --     "reviews_allowed": true,
    --     "average_rating": "0.00",
    --     "rating_count": 0,
    --     "related_ids": [
    --       463,
    --       47,
    --       31,
    --       387,
    --       458
    --     ],
    --     "upsell_ids": [
    --     ],
    --     "cross_sell_ids": [
    --     ],
    --     "parent_id": 0,
    --     "purchase_note": "",
    --     "categories": [
    --       {
    --         "id": 9,
    --         "name": "Clothing",
    --         "slug": "clothing"
    --       },
    --       {
    --         "id": 14,
    --         "name": "T-shirts",
    --         "slug": "t-shirts"
    --       }
    --     ],
    --     "tags": [
    --     ],
    --     "images": [
    --       {
    --         "id": 792,
    --         "date_created": "2017-03-23T14:01:13",
    --         "date_created_gmt": "2017-03-23T20:01:13",
    --         "date_modified": "2017-03-23T14:01:13",
    --         "date_modified_gmt": "2017-03-23T20:01:13",
    --         "src": "https://example.com/wp-content/uploads/2017/03/T_2_front-4.jpg",
    --         "name": "",
    --         "alt": ""
    --       },
    --       {
    --         "id": 793,
    --         "date_created": "2017-03-23T14:01:14",
    --         "date_created_gmt": "2017-03-23T20:01:14",
    --         "date_modified": "2017-03-23T14:01:14",
    --         "date_modified_gmt": "2017-03-23T20:01:14",
    --         "src": "https://example.com/wp-content/uploads/2017/03/T_2_back-2.jpg",
    --         "name": "",
    --         "alt": ""
    --       }
    --     ],
    --     "attributes": [
    --     ],
    --     "default_attributes": [
    --       {
    --         "id": 6,
    --         "name": "Color",
    --         "option": "black"
    --       },
    --       {
    --         "id": 0,
    --         "name": "Size",
    --         "option": "S"
    --       }
    --     ],
    --     "variations": [
    --     ],
    --     "grouped_products": [
    --     ],
    --     "menu_order": 0,
    --     "meta_data": [
    --     ],
    --     "_links": {
    --       "self": [
    --         {
    --           "href": "https://example.com/wp-json/wc/v3/products/794"
    --         }
    --       ],
    --       "collection": [
    --         {
    --           "href": "https://example.com/wp-json/wc/v3/products"
    --         }
    --       ]
    --     }
    --   }
    -- ]

    -- Sample code for parsing the JSON response...
    -- Use the following online tool to generate parsing code from sample JSON:
    -- Generate Parsing Code from JSON

    DECLARE @date_created int
    EXEC @hr = sp_OACreate 'Chilkat.DtObj', @date_created OUT

    DECLARE @date_created_gmt int
    EXEC @hr = sp_OACreate 'Chilkat.DtObj', @date_created_gmt OUT

    DECLARE @date_modified int
    EXEC @hr = sp_OACreate 'Chilkat.DtObj', @date_modified OUT

    DECLARE @date_modified_gmt int
    EXEC @hr = sp_OACreate 'Chilkat.DtObj', @date_modified_gmt OUT

    DECLARE @date_on_sale_from int
    EXEC @hr = sp_OACreate 'Chilkat.DtObj', @date_on_sale_from OUT

    DECLARE @date_on_sale_from_gmt int
    EXEC @hr = sp_OACreate 'Chilkat.DtObj', @date_on_sale_from_gmt OUT

    DECLARE @date_on_sale_to int
    EXEC @hr = sp_OACreate 'Chilkat.DtObj', @date_on_sale_to OUT

    DECLARE @date_on_sale_to_gmt int
    EXEC @hr = sp_OACreate 'Chilkat.DtObj', @date_on_sale_to_gmt OUT

    DECLARE @json int

    DECLARE @id int

    DECLARE @name nvarchar(4000)

    DECLARE @slug nvarchar(4000)

    DECLARE @permalink nvarchar(4000)

    DECLARE @v_type nvarchar(4000)

    DECLARE @status nvarchar(4000)

    DECLARE @featured int

    DECLARE @catalog_visibility nvarchar(4000)

    DECLARE @description nvarchar(4000)

    DECLARE @short_description nvarchar(4000)

    DECLARE @sku nvarchar(4000)

    DECLARE @price nvarchar(4000)

    DECLARE @regular_price nvarchar(4000)

    DECLARE @sale_price nvarchar(4000)

    DECLARE @price_html nvarchar(4000)

    DECLARE @on_sale int

    DECLARE @purchasable int

    DECLARE @total_sales int

    DECLARE @v_virtual int

    DECLARE @downloadable int

    DECLARE @download_limit int

    DECLARE @download_expiry int

    DECLARE @external_url nvarchar(4000)

    DECLARE @button_text nvarchar(4000)

    DECLARE @tax_status nvarchar(4000)

    DECLARE @tax_class nvarchar(4000)

    DECLARE @manage_stock int

    DECLARE @stock_quantity nvarchar(4000)

    DECLARE @stock_status nvarchar(4000)

    DECLARE @backorders nvarchar(4000)

    DECLARE @backorders_allowed int

    DECLARE @backordered int

    DECLARE @sold_individually int

    DECLARE @weight nvarchar(4000)

    DECLARE @dimensionsLength nvarchar(4000)

    DECLARE @dimensionsWidth nvarchar(4000)

    DECLARE @dimensionsHeight nvarchar(4000)

    DECLARE @shipping_required int

    DECLARE @shipping_taxable int

    DECLARE @shipping_class nvarchar(4000)

    DECLARE @shipping_class_id int

    DECLARE @reviews_allowed int

    DECLARE @average_rating nvarchar(4000)

    DECLARE @rating_count int

    DECLARE @parent_id int

    DECLARE @purchase_note nvarchar(4000)

    DECLARE @menu_order int

    DECLARE @j int

    DECLARE @count_j int

    DECLARE @intVal int

    DECLARE @src nvarchar(4000)

    DECLARE @alt nvarchar(4000)

    DECLARE @position int

    DECLARE @visible int

    DECLARE @variation int

    DECLARE @k int

    DECLARE @count_k int

    DECLARE @strVal nvarchar(4000)

    DECLARE @v_option nvarchar(4000)

    DECLARE @href nvarchar(4000)

    DECLARE @i int
    SELECT @i = 0
    DECLARE @count_i int
    EXEC sp_OAGetProperty @jarrResp, 'Size', @count_i OUT
    WHILE @i < @count_i
      BEGIN
        EXEC sp_OAMethod @jarrResp, 'ObjectAt', @json OUT, @i
        EXEC sp_OAMethod @json, 'IntOf', @id OUT, 'id'
        EXEC sp_OAMethod @json, 'StringOf', @name OUT, 'name'
        EXEC sp_OAMethod @json, 'StringOf', @slug OUT, 'slug'
        EXEC sp_OAMethod @json, 'StringOf', @permalink OUT, 'permalink'
        EXEC sp_OAMethod @json, 'DtOf', @success OUT, 'date_created', 0, @date_created
        EXEC sp_OAMethod @json, 'DtOf', @success OUT, 'date_created_gmt', 0, @date_created_gmt
        EXEC sp_OAMethod @json, 'DtOf', @success OUT, 'date_modified', 0, @date_modified
        EXEC sp_OAMethod @json, 'DtOf', @success OUT, 'date_modified_gmt', 0, @date_modified_gmt
        EXEC sp_OAMethod @json, 'StringOf', @v_type OUT, 'type'
        EXEC sp_OAMethod @json, 'StringOf', @status OUT, 'status'
        EXEC sp_OAMethod @json, 'BoolOf', @featured OUT, 'featured'
        EXEC sp_OAMethod @json, 'StringOf', @catalog_visibility OUT, 'catalog_visibility'
        EXEC sp_OAMethod @json, 'StringOf', @description OUT, 'description'
        EXEC sp_OAMethod @json, 'StringOf', @short_description OUT, 'short_description'
        EXEC sp_OAMethod @json, 'StringOf', @sku OUT, 'sku'
        EXEC sp_OAMethod @json, 'StringOf', @price OUT, 'price'
        EXEC sp_OAMethod @json, 'StringOf', @regular_price OUT, 'regular_price'
        EXEC sp_OAMethod @json, 'StringOf', @sale_price OUT, 'sale_price'
        EXEC sp_OAMethod @json, 'DtOf', @success OUT, 'date_on_sale_from', 0, @date_on_sale_from
        EXEC sp_OAMethod @json, 'DtOf', @success OUT, 'date_on_sale_from_gmt', 0, @date_on_sale_from_gmt
        EXEC sp_OAMethod @json, 'DtOf', @success OUT, 'date_on_sale_to', 0, @date_on_sale_to
        EXEC sp_OAMethod @json, 'DtOf', @success OUT, 'date_on_sale_to_gmt', 0, @date_on_sale_to_gmt
        EXEC sp_OAMethod @json, 'StringOf', @price_html OUT, 'price_html'
        EXEC sp_OAMethod @json, 'BoolOf', @on_sale OUT, 'on_sale'
        EXEC sp_OAMethod @json, 'BoolOf', @purchasable OUT, 'purchasable'
        EXEC sp_OAMethod @json, 'IntOf', @total_sales OUT, 'total_sales'
        EXEC sp_OAMethod @json, 'BoolOf', @v_virtual OUT, 'virtual'
        EXEC sp_OAMethod @json, 'BoolOf', @downloadable OUT, 'downloadable'
        EXEC sp_OAMethod @json, 'IntOf', @download_limit OUT, 'download_limit'
        EXEC sp_OAMethod @json, 'IntOf', @download_expiry OUT, 'download_expiry'
        EXEC sp_OAMethod @json, 'StringOf', @external_url OUT, 'external_url'
        EXEC sp_OAMethod @json, 'StringOf', @button_text OUT, 'button_text'
        EXEC sp_OAMethod @json, 'StringOf', @tax_status OUT, 'tax_status'
        EXEC sp_OAMethod @json, 'StringOf', @tax_class OUT, 'tax_class'
        EXEC sp_OAMethod @json, 'BoolOf', @manage_stock OUT, 'manage_stock'
        EXEC sp_OAMethod @json, 'StringOf', @stock_quantity OUT, 'stock_quantity'
        EXEC sp_OAMethod @json, 'StringOf', @stock_status OUT, 'stock_status'
        EXEC sp_OAMethod @json, 'StringOf', @backorders OUT, 'backorders'
        EXEC sp_OAMethod @json, 'BoolOf', @backorders_allowed OUT, 'backorders_allowed'
        EXEC sp_OAMethod @json, 'BoolOf', @backordered OUT, 'backordered'
        EXEC sp_OAMethod @json, 'BoolOf', @sold_individually OUT, 'sold_individually'
        EXEC sp_OAMethod @json, 'StringOf', @weight OUT, 'weight'
        EXEC sp_OAMethod @json, 'StringOf', @dimensionsLength OUT, 'dimensions.length'
        EXEC sp_OAMethod @json, 'StringOf', @dimensionsWidth OUT, 'dimensions.width'
        EXEC sp_OAMethod @json, 'StringOf', @dimensionsHeight OUT, 'dimensions.height'
        EXEC sp_OAMethod @json, 'BoolOf', @shipping_required OUT, 'shipping_required'
        EXEC sp_OAMethod @json, 'BoolOf', @shipping_taxable OUT, 'shipping_taxable'
        EXEC sp_OAMethod @json, 'StringOf', @shipping_class OUT, 'shipping_class'
        EXEC sp_OAMethod @json, 'IntOf', @shipping_class_id OUT, 'shipping_class_id'
        EXEC sp_OAMethod @json, 'BoolOf', @reviews_allowed OUT, 'reviews_allowed'
        EXEC sp_OAMethod @json, 'StringOf', @average_rating OUT, 'average_rating'
        EXEC sp_OAMethod @json, 'IntOf', @rating_count OUT, 'rating_count'
        EXEC sp_OAMethod @json, 'IntOf', @parent_id OUT, 'parent_id'
        EXEC sp_OAMethod @json, 'StringOf', @purchase_note OUT, 'purchase_note'
        EXEC sp_OAMethod @json, 'IntOf', @menu_order OUT, 'menu_order'
        SELECT @j = 0
        EXEC sp_OAMethod @json, 'SizeOfArray', @count_j OUT, 'downloads'
        WHILE @j < @count_j
          BEGIN
            EXEC sp_OASetProperty @json, 'J', @j
            SELECT @j = @j + 1
          END
        SELECT @j = 0
        EXEC sp_OAMethod @json, 'SizeOfArray', @count_j OUT, 'related_ids'
        WHILE @j < @count_j
          BEGIN
            EXEC sp_OASetProperty @json, 'J', @j
            EXEC sp_OAMethod @json, 'IntOf', @intVal OUT, 'related_ids[j]'
            SELECT @j = @j + 1
          END
        SELECT @j = 0
        EXEC sp_OAMethod @json, 'SizeOfArray', @count_j OUT, 'upsell_ids'
        WHILE @j < @count_j
          BEGIN
            EXEC sp_OASetProperty @json, 'J', @j
            SELECT @j = @j + 1
          END
        SELECT @j = 0
        EXEC sp_OAMethod @json, 'SizeOfArray', @count_j OUT, 'cross_sell_ids'
        WHILE @j < @count_j
          BEGIN
            EXEC sp_OASetProperty @json, 'J', @j
            SELECT @j = @j + 1
          END
        SELECT @j = 0
        EXEC sp_OAMethod @json, 'SizeOfArray', @count_j OUT, 'categories'
        WHILE @j < @count_j
          BEGIN
            EXEC sp_OASetProperty @json, 'J', @j
            EXEC sp_OAMethod @json, 'IntOf', @id OUT, 'categories[j].id'
            EXEC sp_OAMethod @json, 'StringOf', @name OUT, 'categories[j].name'
            EXEC sp_OAMethod @json, 'StringOf', @slug OUT, 'categories[j].slug'
            SELECT @j = @j + 1
          END
        SELECT @j = 0
        EXEC sp_OAMethod @json, 'SizeOfArray', @count_j OUT, 'tags'
        WHILE @j < @count_j
          BEGIN
            EXEC sp_OASetProperty @json, 'J', @j
            SELECT @j = @j + 1
          END
        SELECT @j = 0
        EXEC sp_OAMethod @json, 'SizeOfArray', @count_j OUT, 'images'
        WHILE @j < @count_j
          BEGIN
            EXEC sp_OASetProperty @json, 'J', @j
            EXEC sp_OAMethod @json, 'IntOf', @id OUT, 'images[j].id'
            EXEC sp_OAMethod @json, 'DtOf', @success OUT, 'images[j].date_created', 0, @date_created
            EXEC sp_OAMethod @json, 'DtOf', @success OUT, 'images[j].date_created_gmt', 0, @date_created_gmt
            EXEC sp_OAMethod @json, 'DtOf', @success OUT, 'images[j].date_modified', 0, @date_modified
            EXEC sp_OAMethod @json, 'DtOf', @success OUT, 'images[j].date_modified_gmt', 0, @date_modified_gmt
            EXEC sp_OAMethod @json, 'StringOf', @src OUT, 'images[j].src'
            EXEC sp_OAMethod @json, 'StringOf', @name OUT, 'images[j].name'
            EXEC sp_OAMethod @json, 'StringOf', @alt OUT, 'images[j].alt'
            SELECT @j = @j + 1
          END
        SELECT @j = 0
        EXEC sp_OAMethod @json, 'SizeOfArray', @count_j OUT, 'attributes'
        WHILE @j < @count_j
          BEGIN
            EXEC sp_OASetProperty @json, 'J', @j
            EXEC sp_OAMethod @json, 'IntOf', @id OUT, 'attributes[j].id'
            EXEC sp_OAMethod @json, 'StringOf', @name OUT, 'attributes[j].name'
            EXEC sp_OAMethod @json, 'IntOf', @position OUT, 'attributes[j].position'
            EXEC sp_OAMethod @json, 'BoolOf', @visible OUT, 'attributes[j].visible'
            EXEC sp_OAMethod @json, 'BoolOf', @variation OUT, 'attributes[j].variation'
            SELECT @k = 0
            EXEC sp_OAMethod @json, 'SizeOfArray', @count_k OUT, 'attributes[j].options'
            WHILE @k < @count_k
              BEGIN
                EXEC sp_OASetProperty @json, 'K', @k
                EXEC sp_OAMethod @json, 'StringOf', @strVal OUT, 'attributes[j].options[k]'
                SELECT @k = @k + 1
              END
            SELECT @j = @j + 1
          END
        SELECT @j = 0
        EXEC sp_OAMethod @json, 'SizeOfArray', @count_j OUT, 'default_attributes'
        WHILE @j < @count_j
          BEGIN
            EXEC sp_OASetProperty @json, 'J', @j
            EXEC sp_OAMethod @json, 'IntOf', @id OUT, 'default_attributes[j].id'
            EXEC sp_OAMethod @json, 'StringOf', @name OUT, 'default_attributes[j].name'
            EXEC sp_OAMethod @json, 'StringOf', @v_option OUT, 'default_attributes[j].option'
            SELECT @j = @j + 1
          END
        SELECT @j = 0
        EXEC sp_OAMethod @json, 'SizeOfArray', @count_j OUT, 'variations'
        WHILE @j < @count_j
          BEGIN
            EXEC sp_OASetProperty @json, 'J', @j
            SELECT @j = @j + 1
          END
        SELECT @j = 0
        EXEC sp_OAMethod @json, 'SizeOfArray', @count_j OUT, 'grouped_products'
        WHILE @j < @count_j
          BEGIN
            EXEC sp_OASetProperty @json, 'J', @j
            SELECT @j = @j + 1
          END
        SELECT @j = 0
        EXEC sp_OAMethod @json, 'SizeOfArray', @count_j OUT, 'meta_data'
        WHILE @j < @count_j
          BEGIN
            EXEC sp_OASetProperty @json, 'J', @j
            SELECT @j = @j + 1
          END
        SELECT @j = 0
        EXEC sp_OAMethod @json, 'SizeOfArray', @count_j OUT, '_links.self'
        WHILE @j < @count_j
          BEGIN
            EXEC sp_OASetProperty @json, 'J', @j
            EXEC sp_OAMethod @json, 'StringOf', @href OUT, '_links.self[j].href'
            SELECT @j = @j + 1
          END
        SELECT @j = 0
        EXEC sp_OAMethod @json, 'SizeOfArray', @count_j OUT, '_links.collection'
        WHILE @j < @count_j
          BEGIN
            EXEC sp_OASetProperty @json, 'J', @j
            EXEC sp_OAMethod @json, 'StringOf', @href OUT, '_links.collection[j].href'
            SELECT @j = @j + 1
          END
        EXEC @hr = sp_OADestroy @json

        SELECT @i = @i + 1
      END

    EXEC @hr = sp_OADestroy @http
    EXEC @hr = sp_OADestroy @sbResponseBody
    EXEC @hr = sp_OADestroy @jarrResp
    EXEC @hr = sp_OADestroy @date_created
    EXEC @hr = sp_OADestroy @date_created_gmt
    EXEC @hr = sp_OADestroy @date_modified
    EXEC @hr = sp_OADestroy @date_modified_gmt
    EXEC @hr = sp_OADestroy @date_on_sale_from
    EXEC @hr = sp_OADestroy @date_on_sale_from_gmt
    EXEC @hr = sp_OADestroy @date_on_sale_to
    EXEC @hr = sp_OADestroy @date_on_sale_to_gmt


END
GO