(DataFlex) Shopify Basic Authentication: Get List of Products
Demonstrates how to send a simple HTTP GET request with Basic authentication to get a list of products.
Use ChilkatAx-win32.pkg
Procedure Test
Handle hoHttp
String sJsonStr
String sTemp1
Integer iTemp1
Boolean bTemp1
// This example requires 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
// Use your Shopify store's Admin API key and password.
Set ComLogin Of hoHttp To "admin3_api_key"
Set ComPassword Of hoHttp To "admin3_password"
Set ComBasicAuth Of hoHttp To True
Get ComQuickGetStr Of hoHttp "https://mystore.myshopify.com/admin/api/2020-07/products.json" To sJsonStr
Get ComLastMethodSuccess Of hoHttp To bTemp1
If (bTemp1 <> True) Begin
Get ComLastErrorText Of hoHttp To sTemp1
Showln sTemp1
Procedure_Return
End
Get ComLastStatus Of hoHttp To iTemp1
Showln "Response status code: " iTemp1
Showln "JSON response:"
Showln sJsonStr
End_Procedure
|