Yet Another Java-based client to the Gilt Public API
Yes, as if there weren't enough Java clients out there already, I've gone ahead and created my own Java-based client for the Gilt Public REST API located here on GitHub (https://github.com/flungster/gilt_api_client). The library is still very much in its infancy - it was originally created to help me get another open source project up and running (which I'll talk about someday but you'll find in my GitHub account too).
So what does this Java client do exactly? It does the following:
Assuming you provide a valid public API key (which you can get from Gilt by going to dev.gilt.com), it'll connect to the public API and retrieve the current active set of sales and products
A background thread will periodically fetch and cache the sale/product information ensuring you have the latest information. This is currently not configurable but I will change that down the road.
Provides easy access to all this Gilt sale/product goodness in the form of simple Java classes.
Provides a simple keyword targeting class which delivers a set of matching products for a given set of keywords. This needs A LOT of work still but you can try it out if you want.
Some code snippets to get you going.
First off, you'll need to clone and build the repo of course. Once the jar is created, simply add it to your respective project.
To load data from the Gilt Public API, you'll need to write code similar to the following:
import com.giltgroupe.model.Gilt; import com.giltgroupe.net.GiltFetcher; ... Gilt gilt = GiltFetcher.getInstance(); gilt.setApiKey("your api key"); gilt.start(true);
To get the list of active sales for a store (say "women"), you'll write:
Gilt gilt = GiltFetcher.getInstance(); Sales activeSales = gilt.getActiveSales(); List sales = activeSales.findSalesByStore("women");
To get a list of products using a sale key, you'll write:
Gilt gilt = GiltFetcher.getInstance(); Sales activeSales = gilt.getActiveSales(); Sale sale = activeSales.findSaleBySaleKey(); List products = sale.getProducts();
To use the hack-ish keyword targeting feature, do the following:
Gilt gilt = GiltFetcher.getInstance(); Collection foundProducts = gilt.findProductsByBrand(brand);
And.. that's it for now! It's very much a work in progress so do excuse the dust and general nastiness.











