Bob Graham

The Bob Graham 24 Hour Club

Data API v2

PostOptions

All calls take the same second parameter - postOptions. This is a JS object that sets up CORS so that your code may access the API.


{
        method: 'POST',
        mode: 'cors',
        body:  JSON.stringify({}), // see each call on what properties are valid for that call
        headers: {
            'Accept': 'application/json',
            'Content-Type': 'application/json;charset=utf-8'
        }
    }

members

This is analogous to the membersData() call in v1 of the API. It returns an array of details about the requested members. The information returned hasn't been massaged in the way that it has in v1, direction is simply zero or one for example rather than "CW" or "ACW", the given name, family name and deceased information aren't combined into one value.


fetch('http://bobgrahamclub.org.uk/api/v2/members', Postptions);

The body of the options object takes the following properties.


{
	members: [],
		// An array of comma separated membership numbers.
	name:,
		// The surname of a member or members. Only needs to be three letters or more.
	club: ,
		// A club name. Only needs to be a minimum of three letters.
	year: -1,
		// A particular year. Choose a decade by just entering the first three digits.
	columns: []
		// (optional) An array of column names. 
		// If not specified returns the full set of columns.
}

Information returned


{
	gn: // given name
	fn: // family name.
	died: // year of death
	orig: // For second rounds this is the original membership number.
	season: // 0 (summer), 1 (winter) or 2 (mid-winter).
	opt: // 0 (SM -> HR), 1 (HR -> SM)
	dir: // 0 (clockwise) or 1 (anti-clockwise)
	weekNum: // the ISO week number in which the round took place
	age: // their age on the day that they did their round.
	gender: // Male or Female.
	date: // the date of their round.
	time: // the time taken to do the round.
	record: // rounds that were part of the progression of the record.
	lr: // rounds that were part of the progression of the women's record.
	nationality: // obvious
	club: // obvious. Note that this is the club the person belonged to when they did the round, 
		  // we don't monitor changes to club membership.
	prev: // The number of previous attempts (only since 2014)
	postcode: // The first part of the postcode before the space.
}

assists

This call returns how an individual has helped other members.


fetch('http://bobgrahamclub.org.uk/api/v2/assists', Postptions);

The body of the options object takes the following properties.


{
	members: [],
		// An array of comma separated membership numbers.
	columns: []
		// (optional) An array of column names. 
		// If not specified returns the full set of columns.
}

Information returned

The data returned consists of an array of objects containing the following fields:


{
	name: // full name
	mem_num: // membership number
	leg_one:  // the number to times help has been provided on each leg.
	leg_two:
	leg_three:
	leg_four:
	leg_five:
	road: // the number of times help provided at road crossings.
	total: // total number of members helped
	assists: // a space separated list of membership numbers helped by the individual
}

Note that “total” isn’t the sum of legs one to five but the number of individuals helped. If someone has paced legs one and two for just one person then leg_one = 1, leg_two = 1, total = 1.

Also note that if someone hasn't helped on other rounds then the function will return “undefined” rather than zero for them. You might wish to clean this up. See the example at the foot of the page.

Here’s an example:


{
	name: "Peter Dawes",
	mem_num: "23",
	leg_one: "13",
	leg_two: "15",
	leg_three: "24",
	leg_four: "13",
	leg_five: "16",
	road: "3",
	total: "49",
	assists: "49,33 34 44 47 49 59 68 69 71 72 73 74 75 78 98 
			99 111 112 113 114 118 140 141 143 144 147 148 149 
			222 226 227 284 309 312 315 324 365 366 392 430 432
			433 486 491 645 769 771 772 811" 
}

If you are only interested in particular parts of the data returned then you may limit the columns by specifying the column names.


fetch('http://bobgrahamclub.org.uk/api/v2/assists', {
            method: 'POST',
            mode: 'cors',
            body: JSON.stringify({members: [23],
                columns: ["name", "mem_num", "total"]}),
            headers: {
                'Accept': 'application/json',
                'Content-Type': 'application/json;charset=utf-8'
            }
        })

Would return...


{
	name: "Peter Dawes",
	mem_num: "23",
	total: "49",
}

assistedby

This call returns now other members helped a particular member.


fetch('http://bobgrahamclub.org.uk/api/v2/assistedby', Postptions);

The body of the options object takes the following properties.


{
	member: ,
		// The membership number of the person you are interested in.
	columns: []
		// (optional) An array of column names. 
		// If not specified returns the full set of columns.
}

Information returned

The data returned consists of an array of objects containing the following fields:


{
	name: // full name
	mem_num: // membership number
	leg_one:  // the number to times help has been provided on each leg.
	leg_two:
	leg_three:
	leg_four:
	leg_five:
	road: // the number of times help provided at road crossings.
	total: // total number of members helped
	assists: // a space separated list of membership numbers helped by the individual
}

Note that “total” isn’t the sum of legs one to five but the number of individuals helped. If someone has paced legs one and two for just one person then leg_one = 1, leg_two = 1, total = 1.

Also note that if someone hasn't helped on other rounds then the function will return “undefined” rather than zero for them. You might wish to clean this up. See the example at the foot of the page.

Here’s an example:


{
	name: "Peter Dawes",
	mem_num: "23",
	leg_one: "13",
	leg_two: "15",
	leg_three: "24",
	leg_four: "13",
	leg_five: "16",
	road: "3",
	total: "49",
	assists: "49,33 34 44 47 49 59 68 69 71 72 73 74 75 78 98 
			99 111 112 113 114 118 140 141 143 144 147 148 149 
			222 226 227 284 309 312 315 324 365 366 392 430 432
			433 486 491 645 769 771 772 811" 
}

If you are only interested in particular parts of the data returned then you may limit the columns by specifying the column names.


fetch('http://bobgrahamclub.org.uk/api/v2/assistedby', {
            method: 'POST',
            mode: 'cors',
            body: JSON.stringify({member: 23,
                columns: ["name", "mem_num", "total"]}),
            headers: {
                'Accept': 'application/json',
                'Content-Type': 'application/json;charset=utf-8'
            }
        })

Would return...


{
    [
        {
            mem_num: "9",
            name: "Ken Brooks",
            total: "6"
        },
        {
            mem_num: "10",
            name: "Jim Loxham",
            total: "17"
        },
        {
            mem_num: "33",
            name: "Alan Barber",
            total: "19"
        },
        {
            mem_num: "34",
            name: "Tony Simpkins",
            total: "6"
        },
        {
            mem_num: "69",
            name: "Jean Dawes",
            total: "21"
        }
    ]
}