Currently, SnowShoe maintains Ruby, Node, and Wordpress clients (see Maintained Libraries).

📘

Python & PHP SDKs

Please see the Maintained Libraries for download links and Quickstart guides for these SDKs.

📘

Required Dependencies

All our API clients depend on OAuth for constructing the appropriate authentication headers.

Installation

gem install snowshoe
npm install snowshoe
Add the Snowshoe plugin to your Wordpress site by downloading and moving the snowshoe_wordpress folder into your_project/wp-content/plugins, where your site's plugins live.

Via your site's admin panel, navigate to the plugins page and activate the Snowshoe plugin.

Usage: Setting up the client and making a POST

On instantiation of the SnowShoe client, pass in your SNOWSHOE_APP_KEY & SNOWSHOE_APP_SECRET, respectively.

Currently, all posts are made to v2 of the API at https://beta.snowshoestamp.com/api/v2/stamp.

The data object sent to the API is constructed from the point data sent by your front-end stamp screen (see Part 1: Stamp Screen).

The client will return a JSON parsed object (or hash), containing either the serial of the matched stamp (a success!) or an error.

client = Snowshoe::Client.new(SNOWSHOE_APP_KEY, SNOWSHOE_APP_SECRET)
data = { "data" => params["data"] }
response = client.post(data)

if response.include? "stamp"
  # Serve success asset...
else
  # Handle errors...
end
var client = new Snowshoe.client(SNOWSHOE_APP_KEY, SNOWSHOE_APP_SECRET)
var data = {data: request.body.data}

// in order for the callback to behave correctly inside OAuth
// you must include the route's response object as the second argument
client.post(data, response, function(error, data, response){
  if (error) {
    // handle errors
  };
  // handle success
})
/*
Open the file located in your_project/wp-content/plugins/snowshoe_wordpress/snowshoestamp.php and replace your "key" and "secret" in the handle_request function.

Now your site has an api endpoint at "yourdomain.com/api/stamp" that you can POST stamp data too. 
*/

protected function handle_request(){
		global $wp;
		$stamp = $wp->query_vars['data'];
		if(!$stamp)
			$this->send_response('HTTP/1.0 400 Bad request', array(error => "Bad request, no stamp provided"));
		$app_key = "SNOWSHOE_APP_KEY";
		$app_secret = "SNOWSHOE_APP_SECRET";
		$client= new SSSApiClient($app_key, $app_secret);
		$JSONResponse=$client->processData($stamp);
		$this->send_response(_, json_decode($JSONResponse));
	}



/*
NOTE: Currently, without over-riding the plugin's default behavior, you should be submitting stamp data via AJAX using the SnowShoe jQuery plugin. And therefore, handle the response in the success and error properties of your SnowShoe jQuery initialization object, rather than on the server. See our documentation in Part 1 and 3 to learn how.
*/

🚧

Using Express as your back-end API

If you are using Express as your API back-end, make sure you are also including bodyParser. bodyParser enables you to accept the incoming point data from the SnowShoe stamp screen.

Below are examples of success and error JSON responses from the API.

// Success
{
  "stamp": {
    "serial": "DEVA"
  },
  "receipt": "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
  "secure": false,
  "created": "2015-03-24 11:27:33.014149"
}

// Error
{
  "error": {
    "message": "Stamp not found",
    "code": 32
  },
  "receipt": "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
  "secure": false,
  "created": "2015-03-24 11:27:48.235046"
}

Handling success and errors is covered in depth in Part 3: Handling API Responses.