Sample code for 30+ languages & platforms
Delphi DLL

BrickLink OAuth1 using Chilkat HTTP

See more BrickLink Examples

Demonstrates sending an api.bricklink.com request with OAuth1 authentication using Chilkat HTTP.

Chilkat Delphi DLL Downloads

Delphi DLL
uses
    Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
    Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Http, HttpResponse, JsonObject;

...

procedure TForm1.Button1Click(Sender: TObject);
var
success: Boolean;
http: HCkHttp;
resp: HCkHttpResponse;
json: 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();

CkHttp_putOAuth1(http,True);
CkHttp_putOAuthConsumerKey(http,'Your Consumer Key');
CkHttp_putOAuthConsumerSecret(http,'Your Consumer Secret');
CkHttp_putOAuthToken(http,'Your OAuth1 Token');
CkHttp_putOAuthTokenSecret(http,'Your Token Secret');
CkHttp_putOAuthSigMethod(http,'HMAC-SHA1');

resp := CkHttpResponse_Create();
success := CkHttp_HttpNoBody(http,'GET','https://api.bricklink.com/api/store/v1/orders?direction=in',resp);
if (success = False) then
  begin
    Memo1.Lines.Add(CkHttp__lastErrorText(http));
    Exit;
  end;

Memo1.Lines.Add('Response status code = ' + IntToStr(CkHttpResponse_getStatusCode(resp)));

json := CkJsonObject_Create();
CkHttpResponse_GetBodyJson(resp,json);

CkJsonObject_putEmitCompact(json,False);
Memo1.Lines.Add(CkJsonObject__emit(json));

CkHttp_Dispose(http);
CkHttpResponse_Dispose(resp);
CkJsonObject_Dispose(json);

end;