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
(Unicode C) Magento Request with OAuth1.0a AuthenticationDemonstrates sending a Magento request with OAuth1.0a authentication. (Using the Magento 1.x REST API)
#include <C_CkHttpW.h> #include <C_CkJsonObjectW.h> void ChilkatSample(void) { BOOL success; HCkHttpW http; const wchar_t *url; const wchar_t *jsonStr; HCkJsonObjectW json; // This example requires the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. http = CkHttpW_Create(); CkHttpW_putOAuth1(http,TRUE); CkHttpW_putOAuthVerifier(http,L""); CkHttpW_putOAuthConsumerKey(http,L"MAGENTO_CONSUMER_KEY"); CkHttpW_putOAuthConsumerSecret(http,L"MAGENTO_CONSUMER_SECRET"); CkHttpW_putOAuthToken(http,L"MAGENTO__TOKEN"); CkHttpW_putOAuthTokenSecret(http,L"MAGENTO_TOKEN_SECRET"); CkHttpW_putAccept(http,L"application/json"); url = L"http://www.inart.com/api/rest/products/store/2?limit=20&page=1"; jsonStr = CkHttpW_quickGetStr(http,url); if (CkHttpW_getLastMethodSuccess(http) != TRUE) { wprintf(L"%s\n",CkHttpW_lastErrorText(http)); CkHttpW_Dispose(http); return; } wprintf(L"Response status code = %d\n",CkHttpW_getLastStatus(http)); json = CkJsonObjectW_Create(); CkJsonObjectW_Load(json,jsonStr); CkJsonObjectW_putEmitCompact(json,FALSE); wprintf(L"%s\n",CkJsonObjectW_emit(json)); // Use this online tool to generate parsing code from sample JSON: // Generate Parsing Code from JSON CkHttpW_Dispose(http); CkJsonObjectW_Dispose(json); } |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.