Skip to content

hyperpublic/hyperpublic_js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hyperpublic Javascript Library

Using the Javascript Library

Include the hyperpublic.js file hosted from Hyperpublic…

<script type="text/javascript" src="http://hyperpublic.com/javascripts/hyperpublic.js"></script>

or include hyperpublic.js from this repo in your scripts directory. Now you have the ability to create Hyperpublic Javascript objects.

Creating the Hyperpublic Object

Create the Hyperpublic object by declaring something like

var client = new Hyperpublic('your_api_key', 'your_api_secret');

Interacting with the Hyperpublic API

Now you can query against the Hyperpublic API. Each query takes two arguments. The first argument is the query itself while the second argument is the name of the callback function that you have specfied (if you’re not familiar with JSONP, start here).

client.places.find(your_query, your_callback);

Show a Person, Place, or Thing by ID

A simple query for a person who has the id ‘4’ would look something like the call below. This call also triggers a function called ‘callback’.

client.places.show(4, 'callback');

Similarly, you could query for a person by ID with client.people.show(416, 'callback') or a thing with client.thing.show(212, 'callback).

Search for People, Places, or Things

It’s very easy to search the Hyperpublic by sending a series of paramaters to the API. If I wanted to find 2 pizza places in New York, NY 10014, I would issue a query like this:

client.places.find({ "location" : "New York, NY 10014", "q":"pizza", "limit": "2"}, 'callback');

The Hyperpublic API would then return a JSON object which represtents the data available in the callback function.

For detailed documentation on the Hyperpublic API, visit the developer site.

Releases

No releases published

Packages

No packages published