Chris Saunders 09/15/2011

Announcing the release of Shopify4J

Along with rolling out a Python adapter for the Shopify API we'd also like to announce a new Java binding: Shopify4J

This is an Android-compatible library which provides an easy way for Java developers interact with Shopify. We’ve taken care of creating all the Java beans, and API endpoints that you as a developer would need to deal with yourself.

Here is a little example showing how easy it is to use Shopify4J to get a list of products for a shop:

import java.util.List;

import com.shopify.api.client.ShopifyClient;
import com.shopify.api.credentials.Credential;
import com.shopify.api.credentials.JsonDirectoryCredentialsStore;
import com.shopify.api.endpoints.ProductsService;
import com.shopify.api.resources.Product;

public class S4JDemo {

    private ShopifyClient shopify;
    public S4JDemo(){
        // Let's pretend we are just using a developer key for now
        Credential creds = new Credential("my-api-key", "my-shared-secret", "my-shopify-shop", "my-password");
        shopify = new ShopifyClient(creds);

    public void run() {
        // Create a "Products Service" from our client.  This is what makes the API calls to /admin/products
        ProductService productsApi = shopify.constructService(ProductsService.class);
        // Get a list of products for our store -- this is a blocking operation
        List products = productsApi.getProducts();
        // Print out product information to the terminal
        for(Product p : products){
            String message = String.format("%s is made by %s" , product.getTitle(), product.getVendor());

    public static void main(String[] args){
        S4JDemo demo = new S4JDemo();;

* Example output:
* iPhone is made by Apple
* Nexus One is made by HTC
* PlayBook is made by BlackBerry

We'd like to thank the maintainers of Codegist CRest and the Jackson JSON parser for providing awesome tools.