Delphi DLL
Delphi DLL
Shopware Digest Authentication
See more Shopware Examples
Demonstrates using Digest access authentication for Shopware.Chilkat Delphi DLL Downloads
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Http, StringBuilder, JsonObject;
...
procedure TForm1.Button1Click(Sender: TObject);
var
success: Boolean;
http: HCkHttp;
sbResponseBody: HCkStringBuilder;
jResp: HCkJsonObject;
begin
success := False;
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
http := CkHttp_Create();
// To use HTTP Digest Authentication, set the login and password, and also indicate that DigestAuth should be used.
CkHttp_putLogin(http,'api_username');
CkHttp_putPassword(http,'api_key');
CkHttp_putDigestAuth(http,True);
sbResponseBody := CkStringBuilder_Create();
success := CkHttp_QuickGetSb(http,'https://my-shopware-shop.com/api/articles?limit=2',sbResponseBody);
if (success = False) then
begin
Memo1.Lines.Add(CkHttp__lastErrorText(http));
Exit;
end;
jResp := CkJsonObject_Create();
CkJsonObject_LoadSb(jResp,sbResponseBody);
CkJsonObject_putEmitCompact(jResp,False);
Memo1.Lines.Add('Response Body:');
Memo1.Lines.Add(CkJsonObject__emit(jResp));
CkHttp_Dispose(http);
CkStringBuilder_Dispose(sbResponseBody);
CkJsonObject_Dispose(jResp);
end;