SQL Server
SQL Server
WooCommerce Create a Product
See more WooCommerce Examples
Demonstrates how to create a new product in WooCommerce.Chilkat SQL Server Downloads
-- 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 -X POST https://example.com/wp-json/wc/v3/products \
-- -u consumer_key:consumer_secret \
-- -H "Content-Type: application/json" \
-- -d '{
-- "name": "Premium Quality",
-- "type": "simple",
-- "regular_price": "21.99",
-- "description": "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.",
-- "short_description": "Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.",
-- "categories": [
-- {
-- "id": 9
-- },
-- {
-- "id": 14
-- }
-- ],
-- "images": [
-- {
-- "src": "http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/T_2_front.jpg"
-- },
-- {
-- "src": "http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/T_2_back.jpg"
-- }
-- ]
-- }'
-- 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'
-- Use this online tool to generate code from sample JSON:
-- Generate Code to Create JSON
-- The following JSON is sent in the request body.
-- {
-- "name": "Premium Quality",
-- "type": "simple",
-- "regular_price": "21.99",
-- "description": "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.",
-- "short_description": "Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.",
-- "categories": [
-- {
-- "id": 9
-- },
-- {
-- "id": 14
-- }
-- ],
-- "images": [
-- {
-- "src": "http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/T_2_front.jpg"
-- },
-- {
-- "src": "http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/T_2_back.jpg"
-- }
-- ]
-- }
DECLARE @json int
EXEC @hr = sp_OACreate 'Chilkat.JsonObject', @json OUT
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'name', 'Premium Quality'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'type', 'simple'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'regular_price', '21.99'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'description', '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.'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'short_description', 'Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.'
EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'categories[0].id', 9
EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'categories[1].id', 14
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'images[0].src', 'http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/T_2_front.jpg'
EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'images[1].src', 'http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/T_2_back.jpg'
DECLARE @resp int
EXEC @hr = sp_OACreate 'Chilkat.HttpResponse', @resp OUT
EXEC sp_OAMethod @http, 'HttpJson', @success OUT, 'POST', 'https://example.com/wp-json/wc/v3/products', @json, 'application/json', @resp
IF @success = 0
BEGIN
EXEC sp_OAGetProperty @http, 'LastErrorText', @sTmp0 OUT
PRINT @sTmp0
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @json
EXEC @hr = sp_OADestroy @resp
RETURN
END
DECLARE @sbResponseBody int
EXEC @hr = sp_OACreate 'Chilkat.StringBuilder', @sbResponseBody OUT
EXEC sp_OAMethod @resp, 'GetBodySb', @success OUT, @sbResponseBody
DECLARE @jResp int
EXEC @hr = sp_OACreate 'Chilkat.JsonObject', @jResp OUT
EXEC sp_OAMethod @jResp, 'LoadSb', @success OUT, @sbResponseBody
EXEC sp_OASetProperty @jResp, 'EmitCompact', 0
PRINT 'Response Body:'
EXEC sp_OAMethod @jResp, 'Emit', @sTmp0 OUT
PRINT @sTmp0
DECLARE @respStatusCode int
EXEC sp_OAGetProperty @resp, 'StatusCode', @respStatusCode OUT
PRINT 'Response Status Code = ' + @respStatusCode
IF @respStatusCode >= 400
BEGIN
PRINT 'Response Header:'
EXEC sp_OAGetProperty @resp, 'Header', @sTmp0 OUT
PRINT @sTmp0
PRINT 'Failed.'
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @json
EXEC @hr = sp_OADestroy @resp
EXEC @hr = sp_OADestroy @sbResponseBody
EXEC @hr = sp_OADestroy @jResp
RETURN
END
-- Sample JSON response:
-- (Sample code for parsing the JSON response is shown below)
-- {
-- "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\">$</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": [
-- 53,
-- 40,
-- 56,
-- 479,
-- 99
-- ],
-- "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": [
-- ],
-- "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 @intVal int
DECLARE @src nvarchar(4000)
DECLARE @alt nvarchar(4000)
DECLARE @href nvarchar(4000)
DECLARE @id int
EXEC sp_OAMethod @jResp, 'IntOf', @id OUT, 'id'
DECLARE @name nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @name OUT, 'name'
DECLARE @slug nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @slug OUT, 'slug'
DECLARE @permalink nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @permalink OUT, 'permalink'
EXEC sp_OAMethod @jResp, 'DtOf', @success OUT, 'date_created', 0, @date_created
EXEC sp_OAMethod @jResp, 'DtOf', @success OUT, 'date_created_gmt', 0, @date_created_gmt
EXEC sp_OAMethod @jResp, 'DtOf', @success OUT, 'date_modified', 0, @date_modified
EXEC sp_OAMethod @jResp, 'DtOf', @success OUT, 'date_modified_gmt', 0, @date_modified_gmt
DECLARE @v_type nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @v_type OUT, 'type'
DECLARE @status nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @status OUT, 'status'
DECLARE @featured int
EXEC sp_OAMethod @jResp, 'BoolOf', @featured OUT, 'featured'
DECLARE @catalog_visibility nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @catalog_visibility OUT, 'catalog_visibility'
DECLARE @description nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @description OUT, 'description'
DECLARE @short_description nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @short_description OUT, 'short_description'
DECLARE @sku nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @sku OUT, 'sku'
DECLARE @price nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @price OUT, 'price'
DECLARE @regular_price nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @regular_price OUT, 'regular_price'
DECLARE @sale_price nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @sale_price OUT, 'sale_price'
EXEC sp_OAMethod @jResp, 'DtOf', @success OUT, 'date_on_sale_from', 0, @date_on_sale_from
EXEC sp_OAMethod @jResp, 'DtOf', @success OUT, 'date_on_sale_from_gmt', 0, @date_on_sale_from_gmt
EXEC sp_OAMethod @jResp, 'DtOf', @success OUT, 'date_on_sale_to', 0, @date_on_sale_to
EXEC sp_OAMethod @jResp, 'DtOf', @success OUT, 'date_on_sale_to_gmt', 0, @date_on_sale_to_gmt
DECLARE @price_html nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @price_html OUT, 'price_html'
DECLARE @on_sale int
EXEC sp_OAMethod @jResp, 'BoolOf', @on_sale OUT, 'on_sale'
DECLARE @purchasable int
EXEC sp_OAMethod @jResp, 'BoolOf', @purchasable OUT, 'purchasable'
DECLARE @total_sales int
EXEC sp_OAMethod @jResp, 'IntOf', @total_sales OUT, 'total_sales'
DECLARE @virtual int
EXEC sp_OAMethod @jResp, 'BoolOf', @virtual OUT, 'virtual'
DECLARE @downloadable int
EXEC sp_OAMethod @jResp, 'BoolOf', @downloadable OUT, 'downloadable'
DECLARE @download_limit int
EXEC sp_OAMethod @jResp, 'IntOf', @download_limit OUT, 'download_limit'
DECLARE @download_expiry int
EXEC sp_OAMethod @jResp, 'IntOf', @download_expiry OUT, 'download_expiry'
DECLARE @external_url nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @external_url OUT, 'external_url'
DECLARE @button_text nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @button_text OUT, 'button_text'
DECLARE @tax_status nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @tax_status OUT, 'tax_status'
DECLARE @tax_class nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @tax_class OUT, 'tax_class'
DECLARE @manage_stock int
EXEC sp_OAMethod @jResp, 'BoolOf', @manage_stock OUT, 'manage_stock'
DECLARE @stock_quantity nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @stock_quantity OUT, 'stock_quantity'
DECLARE @stock_status nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @stock_status OUT, 'stock_status'
DECLARE @backorders nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @backorders OUT, 'backorders'
DECLARE @backorders_allowed int
EXEC sp_OAMethod @jResp, 'BoolOf', @backorders_allowed OUT, 'backorders_allowed'
DECLARE @backordered int
EXEC sp_OAMethod @jResp, 'BoolOf', @backordered OUT, 'backordered'
DECLARE @sold_individually int
EXEC sp_OAMethod @jResp, 'BoolOf', @sold_individually OUT, 'sold_individually'
DECLARE @weight nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @weight OUT, 'weight'
DECLARE @dimensionsLength nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @dimensionsLength OUT, 'dimensions.length'
DECLARE @dimensionsWidth nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @dimensionsWidth OUT, 'dimensions.width'
DECLARE @dimensionsHeight nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @dimensionsHeight OUT, 'dimensions.height'
DECLARE @shipping_required int
EXEC sp_OAMethod @jResp, 'BoolOf', @shipping_required OUT, 'shipping_required'
DECLARE @shipping_taxable int
EXEC sp_OAMethod @jResp, 'BoolOf', @shipping_taxable OUT, 'shipping_taxable'
DECLARE @shipping_class nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @shipping_class OUT, 'shipping_class'
DECLARE @shipping_class_id int
EXEC sp_OAMethod @jResp, 'IntOf', @shipping_class_id OUT, 'shipping_class_id'
DECLARE @reviews_allowed int
EXEC sp_OAMethod @jResp, 'BoolOf', @reviews_allowed OUT, 'reviews_allowed'
DECLARE @average_rating nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @average_rating OUT, 'average_rating'
DECLARE @rating_count int
EXEC sp_OAMethod @jResp, 'IntOf', @rating_count OUT, 'rating_count'
DECLARE @parent_id int
EXEC sp_OAMethod @jResp, 'IntOf', @parent_id OUT, 'parent_id'
DECLARE @purchase_note nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @purchase_note OUT, 'purchase_note'
DECLARE @menu_order int
EXEC sp_OAMethod @jResp, 'IntOf', @menu_order OUT, 'menu_order'
DECLARE @i int
SELECT @i = 0
DECLARE @count_i int
EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'downloads'
WHILE @i < @count_i
BEGIN
EXEC sp_OASetProperty @jResp, 'I', @i
SELECT @i = @i + 1
END
SELECT @i = 0
EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'related_ids'
WHILE @i < @count_i
BEGIN
EXEC sp_OASetProperty @jResp, 'I', @i
EXEC sp_OAMethod @jResp, 'IntOf', @intVal OUT, 'related_ids[i]'
SELECT @i = @i + 1
END
SELECT @i = 0
EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'upsell_ids'
WHILE @i < @count_i
BEGIN
EXEC sp_OASetProperty @jResp, 'I', @i
SELECT @i = @i + 1
END
SELECT @i = 0
EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'cross_sell_ids'
WHILE @i < @count_i
BEGIN
EXEC sp_OASetProperty @jResp, 'I', @i
SELECT @i = @i + 1
END
SELECT @i = 0
EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'categories'
WHILE @i < @count_i
BEGIN
EXEC sp_OASetProperty @jResp, 'I', @i
EXEC sp_OAMethod @jResp, 'IntOf', @id OUT, 'categories[i].id'
EXEC sp_OAMethod @jResp, 'StringOf', @name OUT, 'categories[i].name'
EXEC sp_OAMethod @jResp, 'StringOf', @slug OUT, 'categories[i].slug'
SELECT @i = @i + 1
END
SELECT @i = 0
EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'tags'
WHILE @i < @count_i
BEGIN
EXEC sp_OASetProperty @jResp, 'I', @i
SELECT @i = @i + 1
END
SELECT @i = 0
EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'images'
WHILE @i < @count_i
BEGIN
EXEC sp_OASetProperty @jResp, 'I', @i
EXEC sp_OAMethod @jResp, 'IntOf', @id OUT, 'images[i].id'
EXEC sp_OAMethod @jResp, 'DtOf', @success OUT, 'images[i].date_created', 0, @date_created
EXEC sp_OAMethod @jResp, 'DtOf', @success OUT, 'images[i].date_created_gmt', 0, @date_created_gmt
EXEC sp_OAMethod @jResp, 'DtOf', @success OUT, 'images[i].date_modified', 0, @date_modified
EXEC sp_OAMethod @jResp, 'DtOf', @success OUT, 'images[i].date_modified_gmt', 0, @date_modified_gmt
EXEC sp_OAMethod @jResp, 'StringOf', @src OUT, 'images[i].src'
EXEC sp_OAMethod @jResp, 'StringOf', @name OUT, 'images[i].name'
EXEC sp_OAMethod @jResp, 'StringOf', @alt OUT, 'images[i].alt'
SELECT @i = @i + 1
END
SELECT @i = 0
EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'attributes'
WHILE @i < @count_i
BEGIN
EXEC sp_OASetProperty @jResp, 'I', @i
SELECT @i = @i + 1
END
SELECT @i = 0
EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'default_attributes'
WHILE @i < @count_i
BEGIN
EXEC sp_OASetProperty @jResp, 'I', @i
SELECT @i = @i + 1
END
SELECT @i = 0
EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'variations'
WHILE @i < @count_i
BEGIN
EXEC sp_OASetProperty @jResp, 'I', @i
SELECT @i = @i + 1
END
SELECT @i = 0
EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'grouped_products'
WHILE @i < @count_i
BEGIN
EXEC sp_OASetProperty @jResp, 'I', @i
SELECT @i = @i + 1
END
SELECT @i = 0
EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'meta_data'
WHILE @i < @count_i
BEGIN
EXEC sp_OASetProperty @jResp, 'I', @i
SELECT @i = @i + 1
END
SELECT @i = 0
EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, '_links.self'
WHILE @i < @count_i
BEGIN
EXEC sp_OASetProperty @jResp, 'I', @i
EXEC sp_OAMethod @jResp, 'StringOf', @href OUT, '_links.self[i].href'
SELECT @i = @i + 1
END
SELECT @i = 0
EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, '_links.collection'
WHILE @i < @count_i
BEGIN
EXEC sp_OASetProperty @jResp, 'I', @i
EXEC sp_OAMethod @jResp, 'StringOf', @href OUT, '_links.collection[i].href'
SELECT @i = @i + 1
END
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @json
EXEC @hr = sp_OADestroy @resp
EXEC @hr = sp_OADestroy @sbResponseBody
EXEC @hr = sp_OADestroy @jResp
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