TrailAPI

FREEMIUM
By trailapi
Updated 5 months ago
Travel
8.4/10
Popularity Score
268ms
Latency
99%
Success Rate
cavealix2 years ago
Same results regardless of query locationI've made successful queries to the API with locations across different states in the US, however the results are always the same trails which are nowhere near the coordinates I queried for.
trailapi2 years ago
The trailhead coordinates are included in the response, when available at the "place" level. Here is a sample response. In this example, you'll note the mountain bike activity info includes an attribute called "length" plus a thumbnail image, and a rating (on a scale of 1-5, 1 being bad, 5 being great.) Depending on the activity type, there are different attributes included. { places: [ { city: "Avon", state: "Colorado", country: "United States", name: "Beaver Creek Ski Resort", parent_id: null, unique_id: 721, directions: "From Denver, take I-70 West to exit 167, Avon. Follow the signs to the Beaver Creek Ski resort. There is no parking once you're up the mountain so be sure to make arrangements.", lat: 39.63121, lon: -106.52535, description: null, date_created: null, children: [ ], activities: [ { name: "Beaver Creek Ski Resort", unique_id: "1-711", place_id: 721, activity_type_id: 5, activity_type_name: "mountain biking", url: "http://www.singletracks.com/bike-trails/beaver-creek-ski-resort.html", attribs: {"length": ""5""}, description: "There are tons of trails here but only a few are serviced by the summer lift. If you are in great shape (or too cheap to buy a ticket), skip the lift and ride up the mountain (all 2000 vertical feet). The "Blue" trails are the singletrack options and they can be pretty challenging for most riders. The singletrack was mostly washed out and very rooty and steep in sections. If you choose the "Green" trails, be prepared to take the road all the way to the bottom. Overall, not one of the best lift serviced downhills available. Go to Keystone instead (although the scenery is tough to beat).", length: 5, activity_type: { created_at: "2012-08-15T16:12:35Z", id: 5, name: "mountain biking", updated_at: "2012-08-15T16:12:35Z" }, thumbnail: "http://www.singletracks.com/images/uploads/2011/07/IMG_0416-0-thumb.jpg", rank: null, rating: 3.8 }, { ... }, { ... }, { ... }, { ... } ] }, { ... } ] }
cavealix2 years ago
I apologize. Something on my end was off as I now have it working though I had given up on it after multiple attempts. Thank you for the confirmation. Is there any plan to add the trail coordinates and other relevant info to the trails?
trailapi2 years ago
Also, these queries for different states in the US also appear to be returning the correct trails within those states. https://trailapi-trailapi.p.mashape.com/?q[state_cont]=Georgia https://trailapi-trailapi.p.mashape.com/?q[state_cont]=California
trailapi2 years ago
Hi cavealix, can you post a couple of the queries you're attempting? For example, these queries for different lat/lon pairs are correctly returning different sets of trails. https://trailapi-trailapi.p.mashape.com/?lat=34&lon=-83&radius=100 https://trailapi-trailapi.p.mashape.com/?lat=34&lon=-84&radius=100
Hi Developer, feel free to post your answer:

Install SDK for NodeJS

Installing

To utilize unirest for node.js install the the npm module:

$ npm install unirest

After installing the npm package you can now start simplifying requests like so:

var unirest = require('unirest');

Creating Request

unirest.get("https://trailapi-trailapi.p.rapidapi.com/trails/explore/")
.header("X-RapidAPI-Host", "trailapi-trailapi.p.rapidapi.com")
.header("X-RapidAPI-Key", "SIGN-UP-FOR-KEY")
.end(function (result) {
  console.log(result.status, result.headers, result.body);
});
OAuth2 Authentication
Client ID
Client Secret
OAuth2 Authentication