(Swift) Shopware Digest Authentication
Demonstrates using Digest access authentication for Shopware. For more information, see https://developers.shopware.com/developers-guide/rest-api/#digest-access-authentication
func chilkatTest() {
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
let http = CkoHttp()!
// To use HTTP Digest Authentication, set the login and password, and also indicate that DigestAuth should be used.
http.login = "api_username"
http.password = "api_key"
http.digestAuth = true
let sbResponseBody = CkoStringBuilder()!
var success: Bool = http.quickGetSb("https://my-shopware-shop.com/api/articles?limit=2", sbContent: sbResponseBody)
if success == false {
print("\(http.lastErrorText!)")
return
}
let jResp = CkoJsonObject()!
jResp.loadSb(sbResponseBody)
jResp.emitCompact = false
print("Response Body:")
print("\(jResp.emit()!)")
}
|