Sample code for 30+ languages & platforms
Java

Shopware Digest Authentication

See more Shopware Examples

Demonstrates using Digest access authentication for Shopware.

Chilkat Java Downloads

Chilkat2 Java
import com.chilkatsoft.chilkat2.ChilkatException;
import com.chilkatsoft.chilkat2.Http;
import com.chilkatsoft.chilkat2.JsonObject;
import com.chilkatsoft.chilkat2.StringBuilder;

public class ChilkatExample {

    public static void main(String[] args) {
        // This example assumes the Chilkat API to have been previously unlocked.
        // See Global Unlock Sample for sample code.

        Http http = new Http();

        // To use HTTP Digest Authentication, set the login and password, and also indicate that DigestAuth should be used.
        http.setLogin("api_username");
        http.setPassword("api_key");
        http.setDigestAuth(true);

        StringBuilder sbResponseBody = new StringBuilder();
        try {
            http.quickGetSb("https://my-shopware-shop.com/api/articles?limit=2", sbResponseBody);
        } catch (ChilkatException e) {
            System.out.println(e.getLastErrorText());
            return;
        }

        JsonObject jResp = new JsonObject();
        jResp.loadSb(sbResponseBody);
        jResp.setEmitCompact(false);

        System.out.println("Response Body:");
        System.out.println(jResp.emit());
    }
}