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
(C) Magento Request with OAuth1.0a AuthenticationDemonstrates sending a Magento request with OAuth1.0a authentication. (Using the Magento 1.x REST API)
#include <C_CkHttp.h> #include <C_CkJsonObject.h> void ChilkatSample(void) { BOOL success; HCkHttp http; const char *url; const char *jsonStr; HCkJsonObject json; // This example requires the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. http = CkHttp_Create(); CkHttp_putOAuth1(http,TRUE); CkHttp_putOAuthVerifier(http,""); CkHttp_putOAuthConsumerKey(http,"MAGENTO_CONSUMER_KEY"); CkHttp_putOAuthConsumerSecret(http,"MAGENTO_CONSUMER_SECRET"); CkHttp_putOAuthToken(http,"MAGENTO__TOKEN"); CkHttp_putOAuthTokenSecret(http,"MAGENTO_TOKEN_SECRET"); CkHttp_putAccept(http,"application/json"); url = "http://www.inart.com/api/rest/products/store/2?limit=20&page=1"; jsonStr = CkHttp_quickGetStr(http,url); if (CkHttp_getLastMethodSuccess(http) != TRUE) { printf("%s\n",CkHttp_lastErrorText(http)); CkHttp_Dispose(http); return; } printf("Response status code = %d\n",CkHttp_getLastStatus(http)); json = CkJsonObject_Create(); CkJsonObject_Load(json,jsonStr); CkJsonObject_putEmitCompact(json,FALSE); printf("%s\n",CkJsonObject_emit(json)); // Use this online tool to generate parsing code from sample JSON: // Generate Parsing Code from JSON CkHttp_Dispose(http); CkJsonObject_Dispose(json); } |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.