Sample code for 30+ languages & platforms
Ruby

Shopware Digest Authentication

See more Shopware Examples

Demonstrates using Digest access authentication for Shopware.

Chilkat Ruby Downloads

Ruby
require 'chilkat'

success = false

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

http = Chilkat::CkHttp.new()

# To use HTTP Digest Authentication, set the login and password, and also indicate that DigestAuth should be used.
http.put_Login("api_username")
http.put_Password("api_key")
http.put_DigestAuth(true)

sbResponseBody = Chilkat::CkStringBuilder.new()
success = http.QuickGetSb("https://my-shopware-shop.com/api/articles?limit=2",sbResponseBody)
if (success == false)
    print http.lastErrorText() + "\n";
    exit
end

jResp = Chilkat::CkJsonObject.new()
jResp.LoadSb(sbResponseBody)
jResp.put_EmitCompact(false)

print "Response Body:" + "\n";
print jResp.emit() + "\n";