Backcountry API
Welcome
API
http://api.backcountry.com
JSON
-
Search
- Product
- Community
API: Search
Send a query string with keywords
http://api.backcountry.com/public/search?q=KEYWORDS
Optional parameters to sort results
pagesize=12
sort=-price
path=code to filter
Example?
Search api example
./app.js
app.post('/', require('./routes/search').doSearch);
./routes/search.js
var agent86 = require('superagent');
exports.doSearch = function(req, res) {
var base = 'http://api.backcountry.com/public/search?q=';
agent86.get(base + req.body.query).end(function (ans) {
res.render('results', {products: ans.body.products});
});
}
./views/results.jade
each product in products
strong #{product.displayName}
json
http://api.backcountry.com/public/search?q=north+face
products: [{
id: 'TNF4809',
displayName: 'Solaris 40 Pack - 2450cu in',
description: 'For a day hike up to that high-mountain lake, The...',
averageReviewRating: '4.6',
reviewCount: 5,
questionCount: 4,
imageCount: 2,
onSale: false,
brandName: 'The North Face',
...
}, {
...
}]
api: product
Specific product information by SKU
http://api.backcountry.com/public/product/SKU
Example?
product api example
./app.js
app.get('/product/:sku', require('./routes/product').details);
./routes/product.js
var agent86 = require('superagent');
exports.details = function(req, res) {
var base = 'http://api.backcountry.com/public/product/';
agent86.get(base + req.params.sku).end(function (ans) {
res.render('product', {products: ans.body});
});
}
./views/product.jade
h3 #{product.title}
.fullDescription #{product.fullDescription}
json
http://api.backcountry.com/public/product/TNF5261
{
bottomLine: 'More warmth, less guilt.',
fullDescription: 'Already a classic, The North Face\'s ...',
bulletPoints: 'Two chest pockets and two hand-warmer pockets ...',
detailImages: [{
blurb: 'Front',
smallUrl: 'http://www.backcountry.com/.../RFIGGN_D1.jpg',
largeUrl: 'http://www.backcountry.com/.../RFIGGN_D1.jpg'
},{
...
}],
productGroup: 'Men\'s Fleece Jackets',
...
}
api: community
User contributed content for a specific product
http://api.backcountry.com/public/community/SKU
Example?
community api example
./app.js
app.get('/community/:sku', require('./routes/community').details);
./routes/community.js
var agent86 = require('superagent');
exports.details = function(req, res) {
var base = 'http://api.backcountry.com/public/community/';
agent86.get(base + req.params.sku).end(function (ans) {
res.render('community', {contnt: JSON.parse(ans.text).attributes});
});
}
./views/community.jade
each r in reviews
.review #{r.body}
JSON
http://api.backcountry.com/public/community/TNF5261
{ photos: [...],
videos: [...],
questions: [...],
reviews: [{
is_flagged: 0,
title: 'Best Fleece Ever Now Gives You Warm Fuzzies!!!',
body: ' encourage people to go for this the recycled version...',
}, {...}],
avg_review_rank: 4,
...
}
Title
live example?
Hackathon 2013 - API
By alejo
Hackathon 2013 - API
API demo for the hackathon
- 944