Datasets – Chlkboard

ChlkBoard
Chlkboard is Singapore Company which offers to information and promotion of local businesses, ranging from F&B to retail shops.

Datasets Available

Dataset Description URL Metadata
BusinessInfoSet Information of Businesses in Singapore http://api.projectnimbus.org/
chlkboardodataservice.svc/
BusinessInfoSet
Click Here

Code Snippet

.NET – How do I access a complete list of Businesses

public List<BusinessInfoEntry> GetBusinessFromNimbusCHKB(string AccountKey, string UniqueUserID)
    {

        System.Net.WebRequest wr=
          HttpWebRequest.Create(
            "http://api.projectnimbus.org/chlkboardodataservice.svc/BusinessInfoSet?");
        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<BusinessInfoEntry> results
          = (from item in XElement.Parse(resStr).Descendants(atomNS + "entry")
            let business = item.Element(atomNS + "content").Element(mNS +"properties")
                select new BusinessInfoEntry() {
                BusinessInfoID = business.Element(dNS +"BusinessInfoID").Value,
                Name = business.Element(dNS +"Name").Value,
                Address = business.Element(dNS + "Address").Value,
                Operating_Hours = business.Element(dNS + "Operating_Hours").Value

            }).ToList();

        return results;
    }

Java – How do I access a complete list of Businesses
public ArrayList<Business> getBusinesses(String accountKey, String uniqueId) {
  businessList = new ArrayList<Business>();
  try {
    URL _url = new URL("http://api.projectnimbus.org/chlkboardodataservice.svc/BusinessInfoSet?");
    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) {
      Business business = new Business();
      business.setBusinessID(Utils.getStringBetween(str,"<d:BusinessID m:type="Edm.Int32">","</d:BusinessID>"));
      business.setName(Utils.getStringBetween(str, "<d:Name>", "</d:Name>"));
      business.setAddress(Utils.getStringBetween(str, "<d:Address>", "</d:Address>"));
      business.setOperating_Hours(Utils.getStringBetween(str, "<d:Operating_Hours>", "</d:Operating_Hours>"));
      businessList.add(business);
      }
    } catch (MalformedURLException ex) {
        ex.printStackTrace();
    } catch (IOException ex) {
        ex.printStackTrace();
    } catch (Exception ex) {
        ex.printStackTrace();
    }
    return movieList;
}

Helpers Available

.NET – C# Proxy Classes: 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.

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