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
(PureBasic) BrickLink OAuth1 using Chilkat RESTSee more BrickLink ExamplesDemonstrates sending an api.bricklink.com request with OAuth1 authentication using Chilkat REST. Note: This example requires Chilkat v9.5.0.91 or greater (due to adjustments made within Chilkat to support bricklink OAuth1 needs). For more information, see https://www.bricklink.com/v3/api.page?page=auth
IncludeFile "CkStringBuilder.pb" IncludeFile "CkRest.pb" IncludeFile "CkJsonObject.pb" IncludeFile "CkOAuth1.pb" Procedure ChilkatExample() ; This example assumes the Chilkat API to have been previously unlocked. ; See Global Unlock Sample for sample code. oauth1.i = CkOAuth1::ckCreate() If oauth1.i = 0 Debug "Failed to create object." ProcedureReturn EndIf CkOAuth1::setCkConsumerKey(oauth1, "Your Consumer Key") CkOAuth1::setCkConsumerSecret(oauth1, "Your Consumer Secret") CkOAuth1::setCkToken(oauth1, "Your OAuth1 Token") CkOAuth1::setCkTokenSecret(oauth1, "Your Token Secret") CkOAuth1::setCkSignatureMethod(oauth1, "HMAC-SHA1") success.i rest.i = CkRest::ckCreate() If rest.i = 0 Debug "Failed to create object." ProcedureReturn EndIf CkRest::ckSetAuthOAuth1(rest,oauth1,0) success = CkRest::ckConnect(rest,"api.bricklink.com",443,1,1) If success = 0 Debug CkRest::ckLastErrorText(rest) CkOAuth1::ckDispose(oauth1) CkRest::ckDispose(rest) ProcedureReturn EndIf sbResponse.i = CkStringBuilder::ckCreate() If sbResponse.i = 0 Debug "Failed to create object." ProcedureReturn EndIf success = CkRest::ckFullRequestNoBodySb(rest,"GET","/api/store/v1/orders?direction=in",sbResponse) If success = 0 Debug CkRest::ckLastErrorText(rest) CkOAuth1::ckDispose(oauth1) CkRest::ckDispose(rest) CkStringBuilder::ckDispose(sbResponse) ProcedureReturn EndIf Debug "Response status code = " + Str(CkRest::ckResponseStatusCode(rest)) json.i = CkJsonObject::ckCreate() If json.i = 0 Debug "Failed to create object." ProcedureReturn EndIf CkJsonObject::ckLoadSb(json,sbResponse) CkJsonObject::setCkEmitCompact(json, 0) Debug CkJsonObject::ckEmit(json) CkOAuth1::ckDispose(oauth1) CkRest::ckDispose(rest) CkStringBuilder::ckDispose(sbResponse) CkJsonObject::ckDispose(json) ProcedureReturn EndProcedure |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.