Package com.zappos.model

Examples of com.zappos.model.JsonObj$Results


    String apikey = "a73121520492f88dc3d33daf2103d7574f1a3166";
    RestTemplate restTemplate = new RestTemplate();
    ObjectMapper mapper = new ObjectMapper();

    System.out.println("sending request...");
    JsonObj obj = new JsonObj();
    try{
      //This api call retrieves the products with a given cost and sorted by product rating.
      obj = mapper.readValue(restTemplate.getForObject("http://api.zappos.com/Search?limit=100&includes=[\"productRating\"]&excludes=[{excludeterms}]&filters={pricefacet}&sort={productrating}&key={apikey}", String.class, excludeterms, pricefacet, productrating, apikey), JsonObj.class);
    }
    catch(HttpClientErrorException e){
      return null;
    }

    System.out.println("request sent...");
    System.out.println("Status Code: "+obj.getStatusCode());
    if(!obj.getStatusCode().equals("200")){
      return null;
    }
    System.out.println("size of Arraylist with duplicates: " + obj.getResults().size());

    Iterator<Results> itr = obj.getResults().iterator();
    HashSet<Results> hs = new HashSet<Results>();

    //This loop generates a list of products without any duplicates.
    while(itr.hasNext()){
      Results temp = itr.next();
View Full Code Here

TOP

Related Classes of com.zappos.model.JsonObj$Results

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.