This API allows access, creation and manipulation of results data including events, subevents, participants, users and uploads. Keep in mind that all data is defaulted to be returned in JSON format.

Events

Events can be shown all at once or individually. With valid authentication they can also be created and updated.

Index


</hr>

This shows all the events in the database. Events will be paginated with 10 results per page and will be presented with a title, event id and address.

GET /api/v1/events

Example

curl -G http://localhost:3000/api/v1/events
[
   {
      title: 'Chicago Charity Run',
      id: 13,
      address: 'Chicago, Illinois',
      asset_id: '13',
      asset_type_id: 'activeworks',
      url: 'http://localhost:3000/events/chicago-charity-run'
   },
   {
      title: 'Los Angeles Marathon',
      id: 12,
      address: 'Los Angeles, CA',
      asset_id: '12',
      asset_type_id: 'regcenter',
      url: 'http://localhost:3000/events/los-angeles-marathon'
   },
   {
      title: 'San Diego Fun Run',
      id: 11,
      address: 'San Diego, CA',
      asset_id: '11',
      asset_type_id: 'activeworks',
      url: 'http://localhost:3000/events/san-diego-fun-run--5'
   }
]

Show


</hr>

This will show information for one event. Information that is shown will include the following:

GET /api/v1/events/:id

Parameters

id
Event id number
Example

curl -G http://localhost:3000/api/v1/events/3
{
   id: 15,
   title: 'New York Mud Run',
   date: '2013-04-05T23:04:00Z',
   asset_type_id: null,
   asset_id: '15',
   event_type: 'run',
   latitude: null,
   longitude: null,
   address: 'Brooklyn, New York\r\n',
   url: 'http://localhost:3000/events/new-york-mud-run',
   user: {
      full_name: 'Jonathan Spooner'
   },
   sub_events: [
      {
         sub_event: {
            id: 14,
            title: '10k'
         }
      }
   ]
}

A single event can also be found using asset_type_id and asset_id

GET /api/v1/events/:asset_id/:asset_type_id

Parameters

asset_id
Asset id of the event
asset_type_id
Asset type id of the event
Example

curl -G http://localhost:3000/api/v1/events/11/activeworks
{
   id: 11,
   title: 'San Diego Fun Run',
   date: '2012-10-01T22:31:00Z',
   asset_type_id: 'activeworks',
   asset_id: '11',
   event_type: 'run',
   latitude: null,
   longitude: null,
   address: 'San Diego, CA',
   url: 'http://localhost:3000/events/san-diego-fun-run--5',
   user: {
      full_name: 'Jonathan Spooner'
   },
   sub_events: [
      {
         sub_event: {
            id: 8,
            title: 'Mile Run'
         }
      }
   ]
}

Create


</hr>

Given the correct parameters and a valid authentication token, this allows a new event to be created.

POST /api/v1/events

Example

curl -F "title='Mud run'" \
     -F "description='First curl test event'" \
     -F "date='2012/12/12'" \
     -F "address='San Diego, Ca'" \
http://localhost:3000/api/v1/events

Update


</hr>

Given the correct parameters and a valid authentication token, this allows an existing event to be updated.

PUT api/v1/events/:id

Parameters

id
id for event to be updated
Example

Subevents

All subevents that belong to an event can be shown at once or a single subevent can be shown individually. With valid authentication, a subevent can also be updated

Index


</hr>

This shows all the subevents that belong to one event. Information about the subevents include id and title.

GET /api/v1/events/:event_id/sub_events

Parameters

event_id
All subevents that belong to the event with this id will be shown
Example
curl -G http://localhost:3000/api/v1/events/3/sub_events
[
   {
      id: 16,
      title: 'Marathon',
      url: 'http://localhost:3000/events/17/sub_events/marathon'
   },
   {
      id: 17,
      title: 'Duathlon',
      url: 'http://localhost:3000/events/17/sub_events/duathlon'
   }
]

Show


</hr>

This shows one subevent that belongs to a single event. Information about the subevent includes:

GET /api/v1/events/:event_id/sub_events/:id

Parameters

event_id
id for the event that the particular subevent belongs to
id
id for the subevent to be shown
Example

curl -G http://localhost:3000/api/v1/events/17/sub_events/17
{
   id: 16,
   title: 'Marathon',
   last_upload: 'http://localhost:3000//system/uploads/result_files/2012/10/1/25U645bc493/legacy_129642.csv?1349132823',
   url: 'http://localhost:3000/events/17/sub_events/marathon',
   participants: [
      {
         participant: {
            id: 5810,
            first_name: 'Dj',
            last_name: 'Maylor'
         }
      },
      {
         participant: {
            id: 5811,
            first_name: 'Ryan',
            last_name: 'Esterline'
         }
      },
      {
         participant: {
            id: 5812,
            first_name: 'Alan',
            last_name: 'Gabalis'
         }
      },
      {
         participant: {
            id: 5813,
            first_name: 'Dave',
            last_name: 'Manges'
         }
      }
   ]
}

Create


</hr>

With valid parameters and access token, this will allow the creation of a new subevent

POST /api/v1/events/:event_id/sub_events

Parameters

event_id
id for the event that the new subevent will belong to
Example

curl -F "title='First curl test subevent'" \
     -F "event_date='2012/12/12'" \
http://localhost:3000/api/v1/events/3/sub_events

Participants

Participants can be shown as all that belong to an event, a subevent or individually.

Index


</hr>

Within an event

This shows all the participants that belong to one event. Participants will be paginated with 25 results per page and will be presented with the following:

GET /api/v1/events/:id/participants

Parameters

id
all participants that belong to the event with this id will be shown
Example

curl -G http://localhost:3000/api/v1/events/3/participants
[
   {
      age: 35,
      bib_id: '2133',
      chip_id: '',
      city: 'Sterling Hts',
      country: '',
      created_at: '2012-10-01T23:07:09Z',
      deleted_at: null,
      email: null,
      first_name: 'Dj',
      gender: 'Male',
      id: 5810,
      last_name: 'Maylor',
      ngb_id: '',
      postal: '48313',
      race_result_id: 5810,
      row_id: 0,
      slug: 'dj-maylor',
      state: 'MI',
      team_name: null,
      updated_at: '2012-10-01T23:07:09Z',
      upload_id: 25,
      user_id: null
   },
   {
      age: 34,
      bib_id: '2017',
      chip_id: '',
      city: 'Vassar',
      country: '',
      created_at: '2012-10-01T23:07:09Z',
      deleted_at: null,
      email: null,
      first_name: 'Ryan',
      gender: 'Male',
      id: 5811,
      last_name: 'Esterline',
      ngb_id: '',
      postal: '48768',
      race_result_id: 5811,
      row_id: 2,
      slug: 'ryan-esterline',
      state: 'MI',
      team_name: null,
      updated_at: '2012-10-01T23:07:09Z',
      upload_id: 25,
      user_id: null
   },
   {
      age: 42,
      bib_id: '2024',
      chip_id: '',
      city: 'Caro',
      country: '',
      created_at: '2012-10-01T23:07:09Z',
      deleted_at: null,
      email: null,
      first_name: 'Alan',
      gender: 'Male',
      id: 5812,
      last_name: 'Gabalis',
      ngb_id: '',
      postal: '48723',
      race_result_id: 5812,
      row_id: 4,
      slug: 'alan-gabalis',
      state: 'MI',
      team_name: null,
      updated_at: '2012-10-01T23:07:09Z',
      upload_id: 25,
      user_id: null
   }
]

Within a subevent

This shows all the participants that belong to a particular subevent. Participants will be paginated with 25 results per page and will be presented with the following:

GET /api/v1/events/:event_id/sub_events/:sub_event_id/participants

Parameters

event_id
sub event belongs to the event with this id
sub_event_id
all participants that belong to the subevent with this id will be shown
Example

curl -G http://localhost:3000/api/v1/events/17/sub_events/17/participants
[
   {
      id: 6056,
      full_name: 'Jo Iannuzzi',
      gender: 'Male',
      age: 51,
      city: 'Marriottsville',
      state: 'MD',
      country: null,
      postal: '21104',
      url: 'http://localhost:3000//events/poker-run/duathlon/jo-iannuzzi'
   },
   {
      id: 6057,
      full_name: 'Ryan Lee Carroll',
      gender: 'Male',
      age: 28,
      city: 'Portsmouth',
      state: 'VA',
      country: null,
      postal: '23701',
      url: 'http://localhost:3000//events/poker-run/duathlon/ryan-lee-carroll'
   },
   {
      id: 6058,
      full_name: 'Luke Belford',
      gender: 'Male',
      age: 28,
      city: 'Nottingham',
      state: 'MD',
      country: null,
      postal: '21236',
      url: 'http://localhost:3000//events/poker-run/duathlon/luke-belford'
   }
]

Show


</hr>

This shows the information for a single participant based on participant id. Participant will be presented with the following information:

GET /api/v1/events/:event_id/sub_events/:sub_event_id/participants/:id

Parameters

event_id
sub event belongs to the event with this id
sub_event_id
participant belongs to the subevent with this id
id
information will be shown for the participant with this id number
Example

curl -G http://localhost:3000/api/v1/events/17/sub_events/17/participants/6056
{
   first_name: 'Jo',
   last_name: 'Iannuzzi',
   gender: 'Male',
   age: 51,
   city: 'Marriottsville',
   state: 'MD',
   country: null,
   postal: '21104',
   user_id: null,
   bib_id: '1688',
   upload_id: 27,
   race_result_id: 6056,
   team_name: null,
   url: 'http://localhost:3000//events/poker-run/duathlon/jo-iannuzzi'
}

This describes the search function of the results API.


</hr>

The overall search provides a method of searching using any query across all fields.

GET /api/v1/search?query=:query

Parameters

query
Search term (event, subevent, participant id or name, address, participant bib id, uploader name, etc.)
Example

curl -G http://localhost:3000/api/v1/search?query=5k
[
   {
      title: '5k and Mile',
      id: 1,
      type: 'event',
      url: 'http://localhost:3000/events/5k-and-mile'
   },
   {
      id: 4045,
      full_name: 'Will Cox',
      type: 'participant',
      url: 'http://localhost:3000//events/madison-color-run/5k/will-cox'
   },
   {
      id: 5438,
      full_name: 'Unknown Runner',
      type: 'participant',
      url: 'http://localhost:3000//events/madison-color-run/5k/unknown-runner--2'
   },
   {
      id: 3765,
      full_name: 'Unknown Runner',
      type: 'participant',
      url: 'http://localhost:3000//events/madison-color-run/5k/unknown-runner'
   },
   {
      id: 4541,
      full_name: 'Will Stone',
      type: 'participant',
      url: 'http://localhost:3000//events/madison-color-run/5k/will-stone'
   }
]

Events


</hr>

Search only through events

GET /api/v1/events?query=:query

Parameters

query
Search term (event name, id, address)
Example

curl -G http://localhost:3000/api/v1/events?query=San%20Diego
[
   {
      title: 'Poker Run',
      id: 17,
      address: 'San Diego, CA',
      asset_id: '17',
      asset_type_id: null,
      url: 'http://localhost:3000/events/poker-run'
   },
   {
      title: 'San Diego Fun Run',
      id: 11,
      address: 'San Diego, CA',
      asset_id: '11',
      asset_type_id: 'activeworks',
      url: 'http://localhost:3000/events/san-diego-fun-run--5'
   }
]

Participant


</hr>

Search for a participant that belongs to a particular sub event.

GET /api/v1/events/:event_id/sub_events/:sub_event_id/participants?query=:query

Parameters

:event_id
id of event being searched within
:sub_event_id
id of sub event being searched within
:query
Search term (participant name, id, age, gender)
Example

curl -G http://localhost:3000/api/v1/events/3/sub_events/3/participants?query=alex
[
   {
      id: 6198,
      full_name: 'Frank Anthony Mannarino',
      gender: 'Male',
      age: 43,
      city: 'Baltimore',
      state: 'MD',
      country: null,
      postal: '21212',
      url: 'http://localhost:3000//events/poker-run/duathlon/frank-anthony-mannarino'
   },
   {
      id: 6595,
      full_name: 'Anthony F Wamwea',
      gender: 'Male',
      age: 23,
      city: 'Parkville',
      state: 'MD',
      country: null,
      postal: '21234',
      url: 'http://localhost:3000//events/poker-run/duathlon/anthony-f-wamwea'
   },
   {
      id: 6899,
      full_name: 'Anthony Pietropola',
      gender: 'Male',
      age: 38,
      city: 'Baltimore',
      state: 'MD',
      country: null,
      postal: '21230',
      url: 'http://localhost:3000//events/poker-run/duathlon/anthony-pietropola'
   }
]

Pagination

All APIs are designed to produce 10 results per page. Results per page is managed by the :limit parameter. Page navigation is managed by a :page parameter.

Limit

The limit parameter will allow the API to return a specified number of results per page. The following example will return 25 results per page instead of the default 10.

GET api/v1/events?limit=25

Parameters

limit
number of results per page
Example

curl -G http://localhost:3000/api/v1/events?limit=25

Page

The page parameter will allow the API to jump to a certain page of results.

GET api/v1/events/:event_id/participants?page=:page

Parameters

event_id
id of event being searched within
page
page number of search results
Example

curl -G http://localhost:3000/api/v1/events/3/participants?page=2

This example will return the second page (results 25 - 50) of all participants that belong to event 3.

curl -G http://localhost:3000/api/v1/events/3/participants?query=john&page=2

This example will return page 2 of all participants of event 3 that include the query "john" somewhere in their full name

Keep in mind that this same limit and pagination works with any results that are returned by the API including all searches and indexes.