|  | 
Chilkat  HOME  Android™  AutoIt  C  C#  C++  Chilkat2-Python  CkPython  Classic ASP  DataFlex  Delphi DLL  Go  Java  Node.js  Objective-C  PHP Extension  Perl  PowerBuilder  PowerShell  PureBasic  Ruby  SQL Server  Swift  Tcl  Unicode C  Unicode C++  VB.NET  VBScript  Visual Basic 6.0  Visual FoxPro  Xojo Plugin
| (Unicode C) 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 
 #include <C_CkOAuth1W.h> #include <C_CkRestW.h> #include <C_CkStringBuilderW.h> #include <C_CkJsonObjectW.h> void ChilkatSample(void) { HCkOAuth1W oauth1; BOOL success; HCkRestW rest; HCkStringBuilderW sbResponse; HCkJsonObjectW json; // This example assumes the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. oauth1 = CkOAuth1W_Create(); CkOAuth1W_putConsumerKey(oauth1,L"Your Consumer Key"); CkOAuth1W_putConsumerSecret(oauth1,L"Your Consumer Secret"); CkOAuth1W_putToken(oauth1,L"Your OAuth1 Token"); CkOAuth1W_putTokenSecret(oauth1,L"Your Token Secret"); CkOAuth1W_putSignatureMethod(oauth1,L"HMAC-SHA1"); rest = CkRestW_Create(); CkRestW_SetAuthOAuth1(rest,oauth1,FALSE); success = CkRestW_Connect(rest,L"api.bricklink.com",443,TRUE,TRUE); if (success == FALSE) { wprintf(L"%s\n",CkRestW_lastErrorText(rest)); CkOAuth1W_Dispose(oauth1); CkRestW_Dispose(rest); return; } sbResponse = CkStringBuilderW_Create(); success = CkRestW_FullRequestNoBodySb(rest,L"GET",L"/api/store/v1/orders?direction=in",sbResponse); if (success == FALSE) { wprintf(L"%s\n",CkRestW_lastErrorText(rest)); CkOAuth1W_Dispose(oauth1); CkRestW_Dispose(rest); CkStringBuilderW_Dispose(sbResponse); return; } wprintf(L"Response status code = %d\n",CkRestW_getResponseStatusCode(rest)); json = CkJsonObjectW_Create(); CkJsonObjectW_LoadSb(json,sbResponse); CkJsonObjectW_putEmitCompact(json,FALSE); wprintf(L"%s\n",CkJsonObjectW_emit(json)); CkOAuth1W_Dispose(oauth1); CkRestW_Dispose(rest); CkStringBuilderW_Dispose(sbResponse); CkJsonObjectW_Dispose(json); } | ||||||
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.