Datasets – HungryGoWhere (HGW)

HungryGoWhere
HungryGoWhere is a guide to the best food, restaurants, bars, and pubs in Singapore, Kuala Lumpur and Hong Kong. Read food reviews and find the best credit card promotions.

Datasets Available

Dataset Description URL Metadata
Restaurants Information of Restaurants in Singapore https://api.projectnimbus.org/hgwodataservice.svc/RestaurantSet Click Here

Code Snippet

.NET – How do I access a complete list of  restaurants near me

public List<RestaurantEntry> GetRestaurantFromNimbusHGW(string AccountKey, string UniqueUserID)
    {

        System.Net.WebRequest wr=
          HttpWebRequest.Create(
            "https://api.projectnimbus.org/hgwodataservice.svc/RestaurantSet?Latitude=1.3&Longitude=103.85&Distance=2000");
        wr.Headers.Add("AccountKey",AccountKey);
        wr.Headers.Add("UniqueUserID",UniqueUserID);
        wr.Method = "GET";
        WebResponse res = wr.GetResponse();
        string resStr
         = new System.IO.StreamReader(res.GetResponseStream()).ReadToEnd();

        XNamespace atomNS
          = "http://www.w3.org/2005/Atom";
        XNamespace dNS
          = "http://schemas.microsoft.com/ado/2007/08/dataservices";
        XNamespace mNS
          = "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata";

        List<RestaurantEntry> results
          = (from item in XElement.Parse(resStr).Descendants(atomNS + "entry")
            let restaurant = item.Element(atomNS + "content").Element(mNS +"properties")
                select new RestaurantEntry() {
                FoodPlace = restaurant.Element(dNS +"FoodPlace").Value,
                POI = restaurant.Element(dNS + "POI").Value,
                CuisineType = restaurant.Element(dNS +"CuisineType").Value,
                Lat = restaurant.Element(dNS + "Latitude").Value,
                Lon = restaurant.Element(dNS + "Longitude").Value
            }).ToList();

        return results;
    }

Java – How do I access a complete list of restaurants near me

public ArrayList<Restaurants> getRestaurants(String accountKey, String uniqueId) {
  restaurantList = new ArrayList<Restaurants>();
  try {
    URL _url = new URL("https://api.projectnimbus.org/hgwodataservice.svc/RestaurantSet?Latitude=1.3&Longitude=103.85&Distance=2000");
    URLConnection _urlConn = _url.openConnection();
    _urlConn.setRequestProperty("accept", "*/*");
    _urlConn.addRequestProperty("AccountKey", accountKey);
    _urlConn.addRequestProperty("UniqueUserID", uniqueId);
    BufferedReader br = new BufferedReader(new InputStreamReader(_urlConn.getInputStream()));
    String line = null;
    StringBuilder strBuilder = new StringBuilder();
    while ((line = br.readLine()) != null) {
      strBuilder.append(line);
      System.out.println(line);
    }
}

String[] IProperties = strBuilder.toString().split("<m:properties>");
    for (String str : IProperties) {
      Restaurants restaurant = new Restaurants();
      restaurant.setFoodPlace(Utils.getStringBetween(str, "<d:FoodPlace>", "</d:FoodPlace>"));
      restaurant.setPOI(Utils.getStringBetween(str, "<d:POI>", "</d:POI>"));
      restaurant.setCuisineType(Utils.getStringBetween(str, "<d:CuisineType>", "</d:CuisineType>"));
      restaurant.setLatitude(Utils.getStringBetween(str, "<d:Latitude m:type=\"Edm.Double\">", "</d:Latitude>"));
      restaurant.setLongitude(Utils.getStringBetween(str, "<d:Longitude m:type=\"Edm.Double\">", "</d:Longitude>"));
      restaurantList.add(restaurant);
      }
    } catch (MalformedURLException ex) {
        ex.printStackTrace();
    } catch (IOException ex) {
        ex.printStackTrace();
    } catch (Exception ex) {
        ex.printStackTrace();
    }
    return restaurantList;
}

Helpers Available

.NET - C# Proxy Classes: click here | Read this blog post for more information to use these proxy classes.

JAVA - Read this blog post for more information to use JAVA to connect to the data service.

PHP & AJAX - Read this blog post for more information to use PHP/AJAX to connect to the data service.

obj C / xcode - coming soon

Terms of Use

The datasets:

  • Are here as a community technology preview for a period of time (TBD).
  • Cannot be used in any public offering.
  • Are offered as-is with no official support.

Support

None at this time.

This entry was posted in Uncategorized. Bookmark the permalink.

One Response to Datasets – HungryGoWhere (HGW)

  1. Pingback: What is Project Nimbus? How do I get started? « Project Nimbus

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s