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
(Delphi DLL) Magento Request with OAuth1.0a AuthenticationDemonstrates sending a Magento request with OAuth1.0a authentication. (Using the Magento 1.x REST API)
uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, JsonObject, Http; ... procedure TForm1.Button1Click(Sender: TObject); var success: Boolean; http: HCkHttp; url: PWideChar; jsonStr: PWideChar; json: HCkJsonObject; begin // 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) then begin Memo1.Lines.Add(CkHttp__lastErrorText(http)); Exit; end; Memo1.Lines.Add('Response status code = ' + IntToStr(CkHttp_getLastStatus(http))); json := CkJsonObject_Create(); CkJsonObject_Load(json,jsonStr); CkJsonObject_putEmitCompact(json,False); Memo1.Lines.Add(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); end; |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.