DataFlex
DataFlex
BrickLink OAuth1 using Chilkat HTTP
See more BrickLink Examples
Demonstrates sending an api.bricklink.com request with OAuth1 authentication using Chilkat HTTP.Chilkat DataFlex Downloads
Use ChilkatAx-win32.pkg
Procedure Test
Boolean iSuccess
Handle hoHttp
Variant vResp
Handle hoResp
Variant vJson
Handle hoJson
String sTemp1
Integer iTemp1
Move False To iSuccess
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
Get Create (RefClass(cComChilkatHttp)) To hoHttp
If (Not(IsComObjectCreated(hoHttp))) Begin
Send CreateComObject of hoHttp
End
Set ComOAuth1 Of hoHttp To True
Set ComOAuthConsumerKey Of hoHttp To "Your Consumer Key"
Set ComOAuthConsumerSecret Of hoHttp To "Your Consumer Secret"
Set ComOAuthToken Of hoHttp To "Your OAuth1 Token"
Set ComOAuthTokenSecret Of hoHttp To "Your Token Secret"
Set ComOAuthSigMethod Of hoHttp To "HMAC-SHA1"
Get Create (RefClass(cComChilkatHttpResponse)) To hoResp
If (Not(IsComObjectCreated(hoResp))) Begin
Send CreateComObject of hoResp
End
Get pvComObject of hoResp to vResp
Get ComHttpNoBody Of hoHttp "GET" "https://api.bricklink.com/api/store/v1/orders?direction=in" vResp To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoHttp To sTemp1
Showln sTemp1
Procedure_Return
End
Get ComStatusCode Of hoResp To iTemp1
Showln "Response status code = " iTemp1
Get Create (RefClass(cComChilkatJsonObject)) To hoJson
If (Not(IsComObjectCreated(hoJson))) Begin
Send CreateComObject of hoJson
End
Get pvComObject of hoJson to vJson
Get ComGetBodyJson Of hoResp vJson To iSuccess
Set ComEmitCompact Of hoJson To False
Get ComEmit Of hoJson To sTemp1
Showln sTemp1
End_Procedure