Sample code for 30+ languages & platforms
PureBasic

Shopify Basic Authentication: Get List of Products

See more Shopify Examples

Demonstrates how to send a simple HTTP GET request with Basic authentication to get a list of products.

Chilkat PureBasic Downloads

PureBasic
IncludeFile "CkHttp.pb"

Procedure ChilkatExample()

    ; This example requires the Chilkat API to have been previously unlocked.
    ; See Global Unlock Sample for sample code.

    http.i = CkHttp::ckCreate()
    If http.i = 0
        Debug "Failed to create object."
        ProcedureReturn
    EndIf

    ; Use your Shopify store's Admin API key and password.
    CkHttp::setCkLogin(http, "admin3_api_key")
    CkHttp::setCkPassword(http, "admin3_password")
    CkHttp::setCkBasicAuth(http, 1)

    jsonStr.s = CkHttp::ckQuickGetStr(http,"https://mystore.myshopify.com/admin/api/2020-07/products.json")
    If CkHttp::ckLastMethodSuccess(http) <> 1
        Debug CkHttp::ckLastErrorText(http)
        CkHttp::ckDispose(http)
        ProcedureReturn
    EndIf

    Debug "Response status code: " + Str(CkHttp::ckLastStatus(http))
    Debug "JSON response:"
    Debug jsonStr


    CkHttp::ckDispose(http)


    ProcedureReturn
EndProcedure