(DataFlex) Shopify OAuth2 Authentication: Get List of Products
Demonstrates how to send a simple HTTP GET request with OAuth2 to get a list of products. The OAuth2 access token was obtained from the Shopify developer console for the created custom app.
Use ChilkatAx-9.5.0-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
Send ComSetRequestHeader To hoHttp "X-Shopify-Access-Token" "admin_api_access_token"
Get ComQuickGetStr Of hoHttp "https://mystore.myshopify.com/admin/api/2022-04/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
|