Sample code for 30+ languages & platforms
Swift

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 Swift Downloads

Swift

func chilkatTest() {
    // This example requires the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

    let http = CkoHttp()!

    // Use your Shopify store's Admin API key and password.
    http.login = "admin3_api_key"
    http.password = "admin3_password"
    http.basicAuth = true

    var jsonStr: String? = http.quickGetStr(url: "https://mystore.myshopify.com/admin/api/2020-07/products.json")
    if http.lastMethodSuccess != true {
        print("\(http.lastErrorText!)")
        return
    }

    print("Response status code: \(http.lastStatus.intValue)")
    print("JSON response:")
    print("\(jsonStr!)")

}