Contents



Introduction

  • The API is currently read-only, the only accepted HTTP method is GET.
  • All API requests must be made via HTTPS
  • All API requests must include a key parameter with a valid API Key value. API Keys can be found on the user profile page .
  • The default response format is JSON. Responses can be formated as json by appending .xml to the request path. For example : https://api.transitandtrails.org/api/v1/trailheads.xml?key=valid_api_key
  • Error handling is limited. Get Trailhead, Trip, Campground and User will return 404 response codes when an invalid ID is specified. Beware of 500 response codes. This will get better, we promise.
[ Contents ]


Trailheads

Trailhead Object

Property Name Description Optional
author_id ID of the user object that created this object
description Text description, may contain HTML True
id Integer ID of this object
latitude Latitude component of the location of this object
longitude Longitude component of the location of this object
name Display name for this object
park_name Display name for the park this object is associated with True

Example

{
    "author_id": 1,
    "description": "<p>\r\n\tTennessee Valley is an amazing offshoot of the Marin Headlands, with hiking trails that suit the whole family. The Tennessee Valley Trail is mostly level; it begins at the parking area and travels 1.7 miles to Tennessee Beach. For the more adventurous hiker, there are a number of other trails leading into the hills above Tennessee Valley.</p>\r\n<div>\r\n\tWith it&#39;s many trails, Tennessee Valley is well suited for the whole family. The area contains a bevy of wildlife; from mighty raptors to common swallows, the birds of the valley will keep your eyes on the skies. The skies are not the only place to view wildlife; the valley is teeming with deer, coyote, and on an occasion you might even see a bobcat.</div>\r\n<div>\r\n\t&nbsp;</div>\r\n<div>\r\n\tFor more information please contact the Marin Headlands Visitor Center at (415) 331-1540</div>\r\n<div>\r\n\t&nbsp;</div>\r\n<div>\r\n\tMore information from the National Park Service <a href=\"http://www.nps.gov/goga/planyourvisit/tennessee_valley.htm\" target=\"_blank\">here</a>.&nbsp;</div>\r\n",
    "id": 292,
    "latitude": 37.860541771999998,
    "longitude": -122.53585919699999,
    "name": "Marin Headlands: Tennessee Valley",
    "park_name": "Golden Gate National Recreation Area"
}

[ Contents ]

List Trailheads

Path

/api/v1/trailheads

Optional Parameters

limit
Maximum number of items to return.
offset
Starting index of items to return.
latitude
must be used with longitude, will only return trailheads near this point
longitude
must be used with latitude, will only return trailheads near this point
distance
distance in miles, will only return trailheads within this distance of latitude and longitude parameters
user_id
A comma separated list of User IDs. Will filter returned trailheads by associated user.
id
A comma separated list of Trailhead IDs. Will filter returned trailheads by given IDs.
non_profit_partner_id
A comma separated list of Non-profit Partner IDs. Will filter returned trailheads by associated non-profit partners.

Example Response

[
    {
        "author_id": 1,
        "id": 1,
        "latitude": 37.910347725000001,
        "longitude": 37.910347725000001,
        "name": "Dornan Drive Parking Lot (South)",
        "park_name": "Miller Knox Regional Shoreline"
    },
    {
        "author_id": 1,
        "id": 2,
        "latitude": 37.9107932422,
        "longitude": 37.9107932422,
        "name": "Seacliff Drive Walk-In Entrance",
        "park_name": "Miller Knox Regional Shoreline"
    },
    {
        "author_id": 1,
        "id": 3,
        "latitude": 37.914033621400002,
        "longitude": 37.914033621400002,
        "name": "Dornan Drive Parking Lot (Picnic Area 2)",
        "park_name": "Miller Knox Regional Shoreline"
    }
]

[ Contents ]

Get Trailhead

Path

/api/v1/trailheads/[id]

Example Response

{
    "author_id": 1,
    "id": 1,
    "latitude": 37.910347725000001,
    "longitude": 37.910347725000001,
    "name": "Dornan Drive Parking Lot (South)",
    "park_name": "Miller Knox Regional Shoreline"
}

[ Contents ]

Get Attributes For Trailhead

Path

/api/v1/trailheads/[id]/attributes

Example Response

[
    {
        "category": 5,
        "category_name": "Barrier Free Access",
        "id": 6,
        "name": "Accessible Restrooms"
    },
    {
        "category": 2,
        "category_name": "Amenities",
        "id": 2,
        "name": "Restrooms"
    },
    {
        "category": 3,
        "category_name": "Activities",
        "id": 11,
        "name": "Hiking"
    }
]

[ Contents ]

Get Photos For Trailhead

Path

/api/v1/trailheads/[id]/photos

Example Response

[
    {
        "medium": "http://farm6.staticflickr.com/5052/5404512081_fb85a087d3.jpg",
        "square": "http://farm6.staticflickr.com/5052/5404512081_fb85a087d3_s.jpg"
    },
    {
        "medium": "http://farm6.staticflickr.com/5013/5404513177_d0e6c30a0c.jpg",
        "square": "http://farm6.staticflickr.com/5013/5404513177_d0e6c30a0c_s.jpg"
    },
    {
        "medium": "http://farm6.staticflickr.com/5137/5405119116_daee0d8a73.jpg",
        "square": "http://farm6.staticflickr.com/5137/5405119116_daee0d8a73_s.jpg"
    }
]

[ Contents ]

Get Maps For Trailhead

Path

/api/v1/trailheads/[id]/maps

Example Response

[
    {
        "url": "http://transitandtrails.org/media/trailheads/292/map/2008-0910-mahe-map-web.pdf"
    },
    {
        "url": "http://www.nps.gov/goga/upload/2008-0910-mahe-map-web.pdf"
    }
]

[ Contents ]

List Trailhead Attributes

Path

/api/v1/trailhead_attributes

Optional Parameters

limit
Maximum number of items to return.
offset
Starting index of items to return.

Example Response

[
    {
        "category": 2,
        "description": "Drinking water is available at this trailhead.",
        "id": 1,
        "name": "Drinking Water"
    },
    {
        "category": 2,
        "description": "There are restrooms at this trailhead.",
        "id": 2,
        "name": "Restrooms"
    },
    {
        "category": 2,
        "description": "There is a visitor center at this trailhead.",
        "id": 3,
        "name": "Visitor Center"
    }
]

[ Contents ]


Campgrounds

Campground Object

Property Name Description Optional
author_id ID of the user object that created this object
description Text description, may contain HTML True
id Integer ID of this object
latitude Latitude component of the location of this object
longitude Longitude component of the location of this object
name Display name for this object
park_name Display name for the park this object is associated with True

Example

{
    "author_id": 1,
    "description": "<p>\r\n\tGreat spot for an overnight on Tam.&nbsp;All campsites are first-come first-served. We suggest calling the ranger station ahead of time to see if sites are available (415-388-2070). The office is open 9- 5 p.m.</p>\r\n<p>\r\n\tSee here for the Mt. Tamalpais State Park <a href=\"http://www.parks.ca.gov/pages/471/files/MtTamalpaisBrochure.pdf\" target=\"_blank\">brochure</a></p>\r\n<p>\r\n\tVisit <a href=\"http://www.parks.ca.gov/?page_id=471\" target=\"_blank\">Mount Tamalpais State Park&#39;s Web site</a> for more information. &nbsp;<a href=\"http://mttam.net/\" target=\"_blank\">MtTam.net </a>also has some great info on activities in the park.&nbsp;</p>\r\n",
    "id": 32,
    "latitude": 37.904576239699999,
    "longitude": -122.604040704,
    "name": "Mt. Tamalpias State Park: Pantoll"
}

[ Contents ]

List Campgrounds

Path

/api/v1/campgrounds

Optional Parameters

limit
Maximum number of items to return.
offset
Starting index of items to return.
user_id
A comma separated list of user_ids. Will filter returned trips by associated user.

Example Response

[
    {
        "author_id": 1,
        "description": null,
        "id": 1,
        "latitude": 37.865806456999998,
        "longitude": -122.425133335,
        "name": "Angel Island State Park",
        "park_name": null
    },
    {
        "author_id": 1,
        "description": null,
        "id": 2,
        "latitude": 37.567462249000002,
        "longitude": -121.686678007,
        "name": "Del Valle Regional Park",
        "park_name": null
    },
    {
        "author_id": 1,
        "description": null,
        "id": 3,
        "latitude": 37.516941077299997,
        "longitude": -121.837131441,
        "name": "Sunol Regional Wilderness",
        "park_name": null
    }
]

[ Contents ]

Get Campground

Path

/api/v1/campgrounds/[id]

Example Response

{
    "author_id": 1,
    "description": null,
    "id": 3,
    "latitude": 37.516941077299997,
    "longitude": -121.837131441,
    "name": "Sunol Regional Wilderness",
    "park_name": null
}

[ Contents ]

Get Attributes For campground

Path

/api/v1/campgrounds/[id]/attributes

Example Response

[
    {
        "category": 5,
        "category_name": "Barrier Free Access",
        "id": 6,
        "name": "Accessible Restrooms"
    },
    {
        "category": 2,
        "category_name": "Amenities",
        "id": 2,
        "name": "Restrooms"
    },
    {
        "category": 3,
        "category_name": "Activities",
        "id": 11,
        "name": "Hiking"
    }
]

[ Contents ]

Get Photos For Campground

Path

/api/v1/campgrounds/[id]/photos

Example Response

[
    {
        "medium": "http://farm6.staticflickr.com/5052/5404512081_fb85a087d3.jpg",
        "square": "http://farm6.staticflickr.com/5052/5404512081_fb85a087d3_s.jpg"
    },
    {
        "medium": "http://farm6.staticflickr.com/5013/5404513177_d0e6c30a0c.jpg",
        "square": "http://farm6.staticflickr.com/5013/5404513177_d0e6c30a0c_s.jpg"
    },
    {
        "medium": "http://farm6.staticflickr.com/5137/5405119116_daee0d8a73.jpg",
        "square": "http://farm6.staticflickr.com/5137/5405119116_daee0d8a73_s.jpg"
    }
]

[ Contents ]

Get Maps For Campground

Path

/api/v1/campgrounds/[id]/maps

Example Response

[
    {
        "url": "http://transitandtrails.org/media/campgrounds/292/map/2008-0910-mahe-map-web.pdf"
    },
    {
        "url": "http://www.nps.gov/goga/upload/2008-0910-mahe-map-web.pdf"
    }
]

[ Contents ]

List Campground Attributes

Path

/api/v1/campground_attributes

Optional Parameters

limit
Maximum number of items to return.
offset
Starting index of items to return.

Example Response

[
    {
        "category": 2,
        "description": "This campground has tent sites.",
        "id": 2,
        "name": "Tent Sites"
    },
    {
        "category": 6,
        "description": "This campground has car accessible camping.",
        "id": 3,
        "name": "Car (Drive up)"
    },
    {
        "category": 2,
        "description": "This campground has running water.",
        "id": 5,
        "name": "Drinking Water"
    }
]

[ Contents ]


Trips

Trip Object

Property Name Description Optional
author_id ID of the user object that created this object
description Text description, may contain HTML True
duration Text description of the trip duration. Half Day, Day Trip, Overnight or 3 Days
ending_trailhead_id Integer ID of the trailhead this trip ends at.
id Integer ID of this object
intensity Text description of the intesity of the trip. Easy, Moderate, or Strenuous
length_miles Lengh of the trip route in miles.
name Display name for this object
starting_trailhead_id Integer ID of the trailhead this trip ends at.

Example

{
"author_id": 16,
"description": "Loop trail (hiking and biking) through oak woodland and grasslands, with volcanic rock outcrops.

", "duration": "Halfday", "ending_trailhead_id": 490, "id": 1, "intensity": "Easy", "length_miles": 4.8327701861360461, "name": "Rockville Hills Regional Park Loop", "starting_trailhead_id": 490 }

[ Contents ]

List Trips

Path

/api/v1/trips

Optional Parameters

limit
Maximum number of items to return.
offset
Starting index of items to return.
user_id
A comma separated list of user_ids. Will filter returned trips by associated user.

Example Response

[
{
"author_id": 16,
"description": "Loop trail (hiking and biking) through oak woodland and grasslands, with volcanic rock outcrops.

", "duration": "Halfday", "ending_trailhead_id": 490, "id": 1, "intensity": "Easy", "length_miles": 4.8327701861360461, "name": "Rockville Hills Regional Park Loop", "starting_trailhead_id": 490 }, { "author_id": 16, "description": "Several loop trails for hiking or biking through oak woodland and chaparral to Lake Marie or up to Sugarloaf Peak.
", "duration": "Halfday", "ending_trailhead_id": 416, "id": 2, "intensity": "Moderate", "length_miles": 6.3464375682385485, "name": "Skyline Wilderness Park Loop", "starting_trailhead_id": 416 }, { "author_id": 16, "description": "Hike or bike from Mountain View Transit Center to Bay at mouth of Stevens Creek, continuing on Bay Trail to Shoreline Park and Palo Alto Baylands for great birding. ", "duration": "Day Trip", "ending_trailhead_id": 285, "id": 3, "intensity": "Moderate", "length_miles": 12.476621801910158, "name": "Stevens Creek to Bay Trail", "starting_trailhead_id_id": 498 } ]

[ Contents ]

Get Trip

Path

/api/v1/trips/[id]

Example Response

{
"author_id": 16,
"description": "Hike or bike from Mountain View Transit Center to Bay at mouth of Stevens Creek, continuing on Bay Trail to Shoreline Park and Palo Alto Baylands for great birding.
",
"duration": "Day Trip",
"ending_trailhead": 285,
"id": 3,
"intensity": "Moderate",
"name": "Stevens Creek to Bay Trail",
"starting_trailhead_id": 498
}

[ Contents ]

Get Route For Trip

Path

/api/v1/trips/[id]/route

Example Response

{
    "route": "[[38.2267818353, -122.147127986], [38.2267818353, -122.147127986], [38.2267818353, -122.147127986], [38.2267818353, -122.147127986], [38.2267818353, -122.147127986], [38.2267818353, -122.147127986], [38.2267818353, -122.147127986], [38.2267818352716, -122.147127985954], [38.2267818353, -122.147127986], [38.22721167360604, -122.14729428291321], [38.227451876274834, -122.14708507061005], [38.22764572346427, -122.14692413806915], [38.22787749659963, -122.14693486690521], [38.22799970395546, -122.14686512947083], [38.2281176970697, -122.14674711227417], [38.228248332080064, -122.14670419692993]]"
}

[ Contents ]

Get Attributes For Trip

Path

/api/v1/trips/[id]/attributes

Example Response

[
    {
        "category": 5,
        "category_name": "Barrier Free Access",
        "id": 6,
        "name": "Accessible Restrooms"
    },
    {
        "category": 2,
        "category_name": "Amenities",
        "id": 2,
        "name": "Restrooms"
    },
    {
        "category": 3,
        "category_name": "Activities",
        "id": 11,
        "name": "Hiking"
    }
]

[ Contents ]

Get Photos For Trip

Path

/api/v1/trips/[id]/photos

Example Response

[
    {
        "medium": "http://farm6.staticflickr.com/5052/5404512081_fb85a087d3.jpg",
        "square": "http://farm6.staticflickr.com/5052/5404512081_fb85a087d3_s.jpg"
    },
    {
        "medium": "http://farm6.staticflickr.com/5013/5404513177_d0e6c30a0c.jpg",
        "square": "http://farm6.staticflickr.com/5013/5404513177_d0e6c30a0c_s.jpg"
    },
    {
        "medium": "http://farm6.staticflickr.com/5137/5405119116_daee0d8a73.jpg",
        "square": "http://farm6.staticflickr.com/5137/5405119116_daee0d8a73_s.jpg"
    }
]

[ Contents ]

Get Maps For Trip

Path

/api/v1/trips/[id]/maps

Example Response

[
    {
        "url": "http://transitandtrails.org/media/trailheads/292/map/2008-0910-mahe-map-web.pdf"
    },
    {
        "url": "http://www.nps.gov/goga/upload/2008-0910-mahe-map-web.pdf"
    }
]

[ Contents ]

List Trip Attributes

Path

/api/v1/trip_attributes

Optional Parameters

limit
- Maximum number of items to return.
offset
- Starting index of items to return.

Example Response

[
    {
        "category": 8,
        "description": "This trip starts and finishes at different trailheads.",
        "id": 2,
        "name": "One Way"
    },
    {
        "category": 7,
        "description": "",
        "id": 7,
        "name": "Trail Hiking"
    },
    {
        "category": 7,
        "description": "",
        "id": 8,
        "name": "Road Biking"
    }
]

[ Contents ]


Users

User Object

Property Name Description Optional
avatar_thumbnail_url URL for the user uploaded profile image thumbnail True
avatar_url URL for the user uploaded profile image True
first_name User's first name True
id Integer ID of this object
last_name User's last name True
organization_name User's organization name True
username User's login name
website_url User's website URL True

Example

{
    "avatar_thumbnail_url": "http://transitandtrails.org/media/user_profiles_avatars/admin/f635bc6c-ae5f-11e1-bfe5-7c6d628e0086.jpg",
    "avatar_url": "http://transitandtrails.org/media/user_profiles_avatars/admin/avatar.png",
    "first_name": "Jereme",
    "id": 1,
    "last_name": "Monteau",
    "organization_name": "Transit & Trails",
    "username": "admin",
    "website_url": "http://transitandtrails.org"
}

[ Contents ]

List Users

Path

/api/v1/users

Optional Parameters

limit
Maximum number of items to return.
offset
Starting index of items to return.

Example Response

[
    {
        "avatar_thumbnail_url": null,
        "avatar_url": null,
        "first_name": "SignUp",
        "id": 1661,
        "last_name": "Embed",
        "organization_name": "SignupEmbed",
        "username": "signupembed",
        "website_url": null
    },
    {
        "avatar_thumbnail_url": "http://localhost:8000/media/user_profiles_avatars/admin/f635bc6c-ae5f-11e1-bfe5-7c6d628e0086.jpg",
        "avatar_url": "http://localhost:8000/media/user_profiles_avatars/admin/avatar.png",
        "first_name": "Jereme",
        "id": 1,
        "last_name": "Monteau",
        "organization_name": "Transit & Trails",
        "username": "admin",
        "website_url": "http://transitandtrails.org"
    },
    {
        "avatar_thumbnail_url": null,
        "avatar_url": null,
        "first_name": null,
        "id": 81,
        "last_name": null,
        "organization_name": null,
        "username": "hema",
        "website_url": null
    }
]

[ Contents ]

Get User

Path

/api/v1/users/[id]

Example Response

{
    "avatar_thumbnail_url": "http://transitandtrails.org/media/user_profiles_avatars/admin/f635bc6c-ae5f-11e1-bfe5-7c6d628e0086.jpg",
    "avatar_url": "http://transitandtrails.org/media/user_profiles_avatars/admin/avatar.png",
    "first_name": "Jereme",
    "id": 1,
    "last_name": "Monteau",
    "organization_name": "Transit & Trails",
    "username": "admin",
    "website_url": "http://transitandtrails.org"
}

[ Contents ]


Attribute Categories

List Attribute Categories

Path

/api/v1/attribute_categories

Optional Parameters

limit - Maximum number of items to return. offset - Starting index of items to return.

Example Response

[
    {
        "description": "What amenities are available at a particular feature (Trailhead, Campground) or are available on par of a Trip?",
        "id": 2,
        "name": "Amenities"
    },
    {
        "description": "What activities are available at the feature (Trailhead, Trip, Campground).",
        "id": 3,
        "name": "Activities"
    },
    {
        "description": "What trail surfaces are accessible from this Trailhead and cover most of the Trip. Dirt, gravel, sand, or paved.",
        "id": 4,
        "name": "Surface"
    }
]

[ Contents ]
© 2013 Transit & Trails. All rights reserved.
Brought to you by: