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

Visual FoxPro 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

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
SendGrid
Shippo
Shopify
Shopware
Shopware 6
SimpleTexting
Square
Stripe
SugarCRM
TicketBAI
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

 

 

 

(Visual FoxPro) WiX Create Product

Creates a new product.

Note: If you get a 403 error response, try refreshing the access token.

For more information, see https://dev.wix.com/api/rest/wix-stores/catalog/product/create-product

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

LOCAL loHttp
LOCAL lnSuccess
LOCAL loJson
LOCAL loResp
LOCAL loSbResponseBody
LOCAL loJResp
LOCAL lnRespStatusCode
LOCAL lcOptionType
LOCAL lcName
LOCAL j
LOCAL lnCount_j
LOCAL lcValue
LOCAL lcDescription
LOCAL lnInStock
LOCAL lnVisible
LOCAL lcId
LOCAL lcChoicesSize
LOCAL lcVariantPriceDataCurrency
LOCAL lcVariantPriceDataPrice
LOCAL lcVariantPriceDataDiscountedPrice
LOCAL lcVariantPriceDataFormattedPrice
LOCAL lcVariantPriceDataFormattedDiscountedPrice
LOCAL lnVariantWeight
LOCAL lnVariantVisible
LOCAL lcProductId
LOCAL lcProductName
LOCAL lcProductSlug
LOCAL lnProductVisible
LOCAL lcProductProductType
LOCAL lcProductDescription
LOCAL lnProductStockTrackInventory
LOCAL lnProductStockInStock
LOCAL lcProductPriceCurrency
LOCAL lcProductPricePrice
LOCAL lcProductPriceDiscountedPrice
LOCAL lcProductPriceFormattedPrice
LOCAL lcProductPriceFormattedDiscountedPrice
LOCAL lcProductPriceDataCurrency
LOCAL lcProductPriceDataPrice
LOCAL lcProductPriceDataDiscountedPrice
LOCAL lcProductPriceDataFormattedPrice
LOCAL lcProductPriceDataFormattedDiscountedPrice
LOCAL lnProductManageVariants
LOCAL lcProductProductPageUrlBase
LOCAL lcProductProductPageUrlPath
LOCAL lcProductNumericId
LOCAL lcProductInventoryItemId
LOCAL lcProductDiscountType
LOCAL lnProductDiscountValue
LOCAL i
LOCAL lnCount_i

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

loHttp = CreateObject('Chilkat_9_5_0.Http')

* Implements the following CURL command:

* curl -X POST \
*    'https://www.wixapis.com/stores/v1/products' \
*     --data-binary '{
*                      "product": {
*                        "name": "T-shirt",
*                        "productType": "physical",
*                        "priceData": {
*                          "price": 10.5
*                        },
*                        "description": "nice summer t-shirt",
*                        "sku": "123df",
*                        "visible": false,
*                        "weight": 0.2,
*                        "discount": {
*                        	"type": "AMOUNT",
*                        	"value": 1
*                        },
*                        "manageVariants": true,
*                        "productOptions": [
*                          {
*                            "name": "Size",
*                            "choices": [
*                              {
*                                "value": "S",
*                                "description": "S"
*                              },
*                              {
*                                "value": "L",
*                                "description": "L"
*                              }
*                            ]
*                          }
*                        ]
*                      }
*                    }' \
*    -H 'Content-Type: application/json' \
*    -H 'Authorization: <AUTH>'

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

* Use this online tool to generate code from sample JSON:
* Generate Code to Create JSON

* The following JSON is sent in the request body.

* {
*   "product": {
*     "name": "T-shirt",
*     "productType": "physical",
*     "priceData": {
*       "price": 10.5
*     },
*     "description": "nice summer t-shirt",
*     "sku": "123df",
*     "visible": false,
*     "weight": 0.2,
*     "discount": {
*       "type": "AMOUNT",
*       "value": 1
*     },
*     "manageVariants": true,
*     "productOptions": [
*       {
*         "name": "Size",
*         "choices": [
*           {
*             "value": "S",
*             "description": "S"
*           },
*           {
*             "value": "L",
*             "description": "L"
*           }
*         ]
*       }
*     ]
*   }
* }

loJson = CreateObject('Chilkat_9_5_0.JsonObject')
loJson.UpdateString("product.name","T-shirt")
loJson.UpdateString("product.productType","physical")
loJson.UpdateNumber("product.priceData.price","10.5")
loJson.UpdateString("product.description","nice summer t-shirt")
loJson.UpdateString("product.sku","123df")
loJson.UpdateBool("product.visible",0)
loJson.UpdateNumber("product.weight","0.2")
loJson.UpdateString("product.discount.type","AMOUNT")
loJson.UpdateInt("product.discount.value",1)
loJson.UpdateBool("product.manageVariants",1)
loJson.UpdateString("product.productOptions[0].name","Size")
loJson.UpdateString("product.productOptions[0].choices[0].value","S")
loJson.UpdateString("product.productOptions[0].choices[0].description","S")
loJson.UpdateString("product.productOptions[0].choices[1].value","L")
loJson.UpdateString("product.productOptions[0].choices[1].description","L")

loHttp.AuthToken = "ACCESS_TOKEN"
loHttp.SetRequestHeader("Content-Type","application/json")

loResp = loHttp.PostJson3("https://www.wixapis.com/stores/v1/products","application/json",loJson)
IF (loHttp.LastMethodSuccess = 0) THEN
    ? loHttp.LastErrorText
    RELEASE loHttp
    RELEASE loJson
    CANCEL
ENDIF

loSbResponseBody = CreateObject('Chilkat_9_5_0.StringBuilder')
loResp.GetBodySb(loSbResponseBody)
loJResp = CreateObject('Chilkat_9_5_0.JsonObject')
loJResp.LoadSb(loSbResponseBody)
loJResp.EmitCompact = 0

? "Response Body:"
? loJResp.Emit()

lnRespStatusCode = loResp.StatusCode
? "Response Status Code = " + STR(lnRespStatusCode)
IF (lnRespStatusCode >= 400) THEN
    ? "Response Header:"
    ? loResp.Header
    ? "Failed."
    RELEASE loResp
    RELEASE loHttp
    RELEASE loJson
    RELEASE loSbResponseBody
    RELEASE loJResp
    CANCEL
ENDIF

RELEASE loResp

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

* {
*   "product": {
*     "id": "e28e4ddd-6ed0-4098-a5e5-cf4bd9c4f7b5",
*     "name": "T-shirt",
*     "slug": "t-shirt-1",
*     "visible": false,
*     "productType": "physical",
*     "description": "nice summer t-shirt",
*     "stock": {
*       "trackInventory": false,
*       "inStock": true
*     },
*     "price": {
*       "currency": "ILS",
*       "price": 10.5,
*       "discountedPrice": 9.5,
*       "formatted": {
*         "price": "10.50",
*         "discountedPrice": "9.50"
*       }
*     },
*     "priceData": {
*       "currency": "ILS",
*       "price": 10.5,
*       "discountedPrice": 9.5,
*       "formatted": {
*         "price": "10.50",
*         "discountedPrice": "9.50"
*       }
*     },
*     "additionalInfoSections": [
*     ],
*     "ribbons": [
*     ],
*     "media": {
*       "items": [
*       ]
*     },
*     "customTextFields": [
*     ],
*     "manageVariants": true,
*     "productOptions": [
*       {
*         "optionType": "drop_down",
*         "name": "Size",
*         "choices": [
*           {
*             "value": "S",
*             "description": "S",
*             "inStock": true,
*             "visible": true
*           },
*           {
*             "value": "L",
*             "description": "L",
*             "inStock": true,
*             "visible": true
*           }
*         ]
*       }
*     ],
*     "productPageUrl": {
*       "base": "https://www.itsjusttooeasy123.com/",
*       "path": "/product-page/t-shirt-1"
*     },
*     "numericId": "1567588455405000",
*     "inventoryItemId": "1d71b222-912f-bf67-5a1a-30b4263b084a",
*     "discount": {
*       "type": "AMOUNT",
*       "value": 1
*     },
*     "collectionIds": [
*     ],
*     "variants": [
*       {
*         "id": "00000000-0000-0001-0005-93fc95e0514a",
*         "choices": {
*           "Size": "S"
*         },
*         "variant": {
*           "priceData": {
*             "currency": "ILS",
*             "price": 10.5,
*             "discountedPrice": 9.5,
*             "formatted": {
*               "price": "10.50",
*               "discountedPrice": "9.50"
*             }
*           },
*           "weight": 10,
*           "visible": true
*         }
*       },
*       {
*         "id": "00000000-0000-0002-0005-93fc95e0514a",
*         "choices": {
*           "Size": "L"
*         },
*         "variant": {
*           "priceData": {
*             "currency": "ILS",
*             "price": 10.5,
*             "discountedPrice": 9.5,
*             "formatted": {
*               "price": "10.50",
*               "discountedPrice": "9.50"
*             }
*           },
*           "visible": true
*         }
*       }
*     ]
*   }
* }

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

lcProductId = loJResp.StringOf("product.id")
lcProductName = loJResp.StringOf("product.name")
lcProductSlug = loJResp.StringOf("product.slug")
lnProductVisible = loJResp.BoolOf("product.visible")
lcProductProductType = loJResp.StringOf("product.productType")
lcProductDescription = loJResp.StringOf("product.description")
lnProductStockTrackInventory = loJResp.BoolOf("product.stock.trackInventory")
lnProductStockInStock = loJResp.BoolOf("product.stock.inStock")
lcProductPriceCurrency = loJResp.StringOf("product.price.currency")
lcProductPricePrice = loJResp.StringOf("product.price.price")
lcProductPriceDiscountedPrice = loJResp.StringOf("product.price.discountedPrice")
lcProductPriceFormattedPrice = loJResp.StringOf("product.price.formatted.price")
lcProductPriceFormattedDiscountedPrice = loJResp.StringOf("product.price.formatted.discountedPrice")
lcProductPriceDataCurrency = loJResp.StringOf("product.priceData.currency")
lcProductPriceDataPrice = loJResp.StringOf("product.priceData.price")
lcProductPriceDataDiscountedPrice = loJResp.StringOf("product.priceData.discountedPrice")
lcProductPriceDataFormattedPrice = loJResp.StringOf("product.priceData.formatted.price")
lcProductPriceDataFormattedDiscountedPrice = loJResp.StringOf("product.priceData.formatted.discountedPrice")
lnProductManageVariants = loJResp.BoolOf("product.manageVariants")
lcProductProductPageUrlBase = loJResp.StringOf("product.productPageUrl.base")
lcProductProductPageUrlPath = loJResp.StringOf("product.productPageUrl.path")
lcProductNumericId = loJResp.StringOf("product.numericId")
lcProductInventoryItemId = loJResp.StringOf("product.inventoryItemId")
lcProductDiscountType = loJResp.StringOf("product.discount.type")
lnProductDiscountValue = loJResp.IntOf("product.discount.value")
i = 0
lnCount_i = loJResp.SizeOfArray("product.additionalInfoSections")
DO WHILE i < lnCount_i
    loJResp.I = i
    i = i + 1
ENDDO
i = 0
lnCount_i = loJResp.SizeOfArray("product.ribbons")
DO WHILE i < lnCount_i
    loJResp.I = i
    i = i + 1
ENDDO
i = 0
lnCount_i = loJResp.SizeOfArray("product.media.items")
DO WHILE i < lnCount_i
    loJResp.I = i
    i = i + 1
ENDDO
i = 0
lnCount_i = loJResp.SizeOfArray("product.customTextFields")
DO WHILE i < lnCount_i
    loJResp.I = i
    i = i + 1
ENDDO
i = 0
lnCount_i = loJResp.SizeOfArray("product.productOptions")
DO WHILE i < lnCount_i
    loJResp.I = i
    lcOptionType = loJResp.StringOf("product.productOptions[i].optionType")
    lcName = loJResp.StringOf("product.productOptions[i].name")
    j = 0
    lnCount_j = loJResp.SizeOfArray("product.productOptions[i].choices")
    DO WHILE j < lnCount_j
        loJResp.J = j
        lcValue = loJResp.StringOf("product.productOptions[i].choices[j].value")
        lcDescription = loJResp.StringOf("product.productOptions[i].choices[j].description")
        lnInStock = loJResp.BoolOf("product.productOptions[i].choices[j].inStock")
        lnVisible = loJResp.BoolOf("product.productOptions[i].choices[j].visible")
        j = j + 1
    ENDDO
    i = i + 1
ENDDO
i = 0
lnCount_i = loJResp.SizeOfArray("product.collectionIds")
DO WHILE i < lnCount_i
    loJResp.I = i
    i = i + 1
ENDDO
i = 0
lnCount_i = loJResp.SizeOfArray("product.variants")
DO WHILE i < lnCount_i
    loJResp.I = i
    lcId = loJResp.StringOf("product.variants[i].id")
    lcChoicesSize = loJResp.StringOf("product.variants[i].choices.Size")
    lcVariantPriceDataCurrency = loJResp.StringOf("product.variants[i].variant.priceData.currency")
    lcVariantPriceDataPrice = loJResp.StringOf("product.variants[i].variant.priceData.price")
    lcVariantPriceDataDiscountedPrice = loJResp.StringOf("product.variants[i].variant.priceData.discountedPrice")
    lcVariantPriceDataFormattedPrice = loJResp.StringOf("product.variants[i].variant.priceData.formatted.price")
    lcVariantPriceDataFormattedDiscountedPrice = loJResp.StringOf("product.variants[i].variant.priceData.formatted.discountedPrice")
    lnVariantWeight = loJResp.IntOf("product.variants[i].variant.weight")
    lnVariantVisible = loJResp.BoolOf("product.variants[i].variant.visible")
    i = i + 1
ENDDO

RELEASE loHttp
RELEASE loJson
RELEASE loSbResponseBody
RELEASE loJResp


 

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