This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'kasabi' | |
require 'json' | |
#change to your API key | |
APIKEY = "YOUR_API_KEY" | |
dataset = Kasabi::Dataset.new("http://kasabi.com/dataset/nasa", :apikey => APIKEY ) | |
#Search for "Apollo", limiting to 5 results |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'kasabi' | |
require 'json' | |
#change to your API key | |
APIKEY = "YOUR_API_KEY" | |
dataset = Kasabi::Dataset.new("http://kasabi.com/dataset/nasa", :apikey => APIKEY ) | |
#Search for "Apollo", limiting to 5 results |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'kasabi' | |
require 'json' | |
require 'rdf' | |
require 'rdf/json' | |
#Demonstration api key | |
APIKEY = "YOUR_API_KEY" | |
dataset = Kasabi::Dataset.new("http://kasabi.com/dataset/nasa", :apikey => APIKEY ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'kasabi' | |
#Demonstration api key | |
APIKEY = "YOUR_API_KEY" | |
dataset = Kasabi::Dataset.new("http://kasabi.com/dataset/nasa", :apikey => APIKEY ) | |
#SPARQL query to find name of spacecraft launched on 16th July 1969, as JSON" | |
QUERY = <<-EOL |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sinatra' | |
require 'kasabi' | |
get '/' do | |
dataset = Kasabi::Dataset.new("http://data.kasabi.com/dataset/nasa", :apikey => ENV["KASABI_API_KEY"]) | |
@query = params[:query] || "apollo" | |
@results = dataset.search_api_client.search(@query) | |
template =<<-EOL | |
<html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "rubygems" | |
require "bundler" | |
Bundler.require | |
require "./app" | |
run Sinatra::Application |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source :rubyforge | |
gem 'rack' | |
gem 'sinatra' | |
gem 'kasabi' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create an apache proxy with Kasabi apikey header injection | |
# Requests to http://127.0.0.1/kasabi will be forwarded and have the X-KASABI-APIKEY header set. | |
# e.g. | |
# http://127.0.0.1/kasabi/dataset/food/apis/search?query=fish | |
# will be forwarded to | |
# http://api.kasabi.com/dataset/food/apis/search?query=fish | |
# and responses will be passed back to the client | |
NameVirtualHost * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# add this to your user's .profile | |
KASABI_API_KEY="123MYSECRETKEY" ; export KASABI_API_KEY |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// set some kasabi variables | |
$kasabi_api_base = "http://api.kasabi.com"; | |
$kasabi_api_key = getenv('KASABI_API_KEY'); | |
// now use the key in anger | |
$my_query = "grilled fish"; | |
$my_url = $kasabi_api_base."/dataset/food/apis/search?query=".urlencode($my_query)."&apikey=".$kasabi_api_key; | |
// now do something amazing... |
OlderNewer