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
(Visual FoxPro) Update an Inventory Listing using OAuth1 AuthenticationSee more Etsy ExamplesUpdates an inventory listing. This example uses OAuth1 authentication instead of providing an api_key=MY_ETSY_KEYSTRING query parameter.
LOCAL loRest LOCAL lnSuccess LOCAL loJson LOCAL loOauth1 LOCAL lnAutoReconnect LOCAL lnTls LOCAL lcJsonText LOCAL lcJsonResponseText LOCAL loJsonResponse * This example assumes the Chilkat API to have been previously unlocked. * See Global Unlock Sample for sample code. loRest = CreateObject('Chilkat_9_5_0.Rest') * See this example for getting an OAuth1 token for Etsy loJson = CreateObject('Chilkat_9_5_0.JsonObject') lnSuccess = loJson.LoadFile("qa_data/tokens/etsy.json") IF (lnSuccess = 0) THEN ? "Failed to load previously fetched Etsy OAuth1 access token." RELEASE loRest RELEASE loJson CANCEL ENDIF loOauth1 = CreateObject('Chilkat_9_5_0.OAuth1') loOauth1.ConsumerKey = "app_keystring" loOauth1.ConsumerSecret = "app_shared_secret" loOauth1.Token = loJson.StringOf("oauth_token") loOauth1.TokenSecret = loJson.StringOf("oauth_token_secret") loOauth1.SignatureMethod = "HMAC-SHA1" loOauth1.GenNonce(16) lnAutoReconnect = 1 lnTls = 1 lnSuccess = loRest.Connect("openapi.etsy.com",443,lnTls,lnAutoReconnect) IF (lnSuccess = 0) THEN ? loRest.LastErrorText RELEASE loRest RELEASE loJson RELEASE loOauth1 CANCEL ENDIF * Tell the REST object to use the OAuth1 object. lnSuccess = loRest.SetAuthOAuth1(loOauth1,1) lcJsonText = '[{"product_id":1999949999,"property_values":[],"offerings":[{"offering_id":9999905883,"price":"36.23","quantity":1}]}]' loRest.AddQueryParam("products",lcJsonText) loRest.AddHeader("Content-Type","application/x-www-form-urlencoded") lcJsonResponseText = loRest.FullRequestFormUrlEncoded("PUT","/v2/listings/228827035/inventory") IF (loRest.LastMethodSuccess = 0) THEN ? loRest.LastErrorText RELEASE loRest RELEASE loJson RELEASE loOauth1 CANCEL ENDIF loJsonResponse = CreateObject('Chilkat_9_5_0.JsonObject') loJsonResponse.Load(lcJsonResponseText) loJsonResponse.EmitCompact = 0 ? loJsonResponse.Emit() ? "Response status code: " + STR(loRest.ResponseStatusCode) RELEASE loRest RELEASE loJson RELEASE loOauth1 RELEASE loJsonResponse |
© 2000-2023 Chilkat Software, Inc. All Rights Reserved.