Posts Tagged ‘json’

Observing & Querying Tweets (Part 3)

Wednesday, January 13th, 2010 by admin

In my previous posts I’ve discussed how to fetch data from Twitter and massage it into the form that is needed when observing data in Sierra. I also talked about how to “POST” that data to Sierra so that it’s available to query. In this post I’m going to discuss the process of actually querying that data once it’s in Sierra.

Before you read on you may want to browse over the Sierra documentation. These docs list all of the REST calls that are available on Sierra. In my example below I’ll be using the “connections” call.

I should also note that I’ve made some additions to the source code that I’ve used across all of these posts. That code is available along with the rest of the Sierra sample code. In particular I’ve made the code aware of command-line options that specify whether you are “observing” (-o) or “querying” (-q). You can also define all of the needed usernames and passwords via the command-line as well.

(more…)

Tags: , , , , ,
Posted in SaffronSierra | 1 Comment »

REST, jQuery, JSONP, & Grails

Monday, September 14th, 2009 by admin

As we started building the REST API for Saffron Sierra we wanted an easy way to test it from within a web browser.  REST APIs run on top of HTTP so this makes pretty good sense.  At first we used the REST Client plugin for Firefox, which was great, but as we added authentication and other things to the API using the REST Client plugin began to be a little cumbersome.  I started toying with the idea of putting together a very basic test harness using HTML and Javascript.  The hope was that it would provide a good testing tool, but also give future users of Sierra a basic tool to use and learn from.

I had been wanting to use and learn jQuery for quite some time.  We (Saffron Technology) had used Prototype in the past for a lot of our applications.  I noticed a while back that there seemed to be a lot of buzz surrounding jQuery and wanted to see what it was all about.  The hope was that jQuery would provide a quick an easy way to consume the JSON responses from the Sierra REST APIS.  It well exceeded my expectations in this department.

The development of the first few pages and API calls went very smoothly and things looked great while testing on my local development workstation.  However, as I tried to use the test harness to access remote Sierra instances I noticed I wasn’t getting the responses I would expect, in fact, I wasn’t getting responses at all.  It turns out this was due to web browsers enforcing tight security when it comes to calling other domains/sites from the domain on which you’re currently running.  This issue is well documented in this wikipedia article.
(more…)

Tags: , , , , , ,
Posted in SaffronSierra | 1 Comment »