Sample code for 30+ languages & platforms
Java

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

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

public class ChilkatExample {

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

        Http http = new Http();

        // Use your Shopify store's Admin API key and password.
        http.setLogin("admin3_api_key");
        http.setPassword("admin3_password");
        http.setBasicAuth(true);

        String jsonStr;
        try {
            jsonStr = http.quickGetStr("https://mystore.myshopify.com/admin/api/2020-07/products.json");
        } catch (ChilkatException e) {
            System.out.println(e.getLastErrorText());
            return;
        }

        System.out.println("Response status code: " + http.getLastStatus());
        System.out.println("JSON response:");
        System.out.println(jsonStr);
    }
}