Coder Social home page Coder Social logo

sports-api's Introduction

Sports API v.1

This is the source code running the sports API. Its everything needed to start running a local copy of the API. Currently it supports only the NFL. The first few days, it will simply be a sql file and reference documentation, no code. Code will be written to fit the spec.

Shared Paramters

Base url: http://api.example.com/v1/football/nfl/

Common params:

fields - a comma separated list of fields, surrounded by parenthesis, of fields to return

ex: teams/123?fields=(headCoach,venue)

limit - the maximum number of response objecs to return. This cannot exceed the limit imposed by the API itself.

ex: limit=50

offset - the number of results to exclude from the front of the list. The first result will be the n+1th result.

ex: offset=50

type - the format of the return object. Most methods support xml, json, and csv by default.

suppress_error_codes - can be set to true in order to always return a 200 HTTP response code instead of the proper HTTP response code. Error messages will still be included in the response object.

Rate limiting will return the following response, and all other errors will follow this pattern.

403:

{
	"error":{
		"error": 403,
		"message": "Rate limit exceeded",
		"description": "IP may not exceed 60 API calls a minute",
		"userMessage": "The application must wait before retrieving more information from the severs.",
		"code": "RATE:001"
	}
}

Method List

teams

Method URL Alias
GET teams
GET teams/afc teams?q=(conference:afc)
GET teams/nfc teams?q=(conference:nfc)
GET teams/afc/<division> teams?q=(conference:afc,division:<division>)
GET teams/nfc/<division> teams?q=(conference:nfc,division:<division>)
GET teams/<id> teams?q=(id:<id>)
GET teams/<name> teams?q=(name:<team_name>)

Responses

200:

{
	"teams": [
		"<team_name>": {
			"city": <city:String>,
			"owner": <owner_name:String>,
			"headCoach": <head_coach_name:String>,
			"offensiveCoordinator": <oc_name:String>,
			"defensiveCoordinator": <dc_name:String>,
			"conference": <conference:EnumString>,
			"division": <division:EnumString>,
			"homeField": {
				"name": <venue_name:String>,
				"city": <venue_city:String>,
				"capacity": <venue_capacity:Int>
			},
			"established": <establishment_year:Int>,
			"divisionalStanding": <div_standing:Int>,
			"conferenceStanding": <con_standing:Int>
		},
		{...}
	]
}

division: NORTH, SOUTH, EAST, WEST

div_standing: 1-4

con_standing: 1-16

players

Method URL Alias
GET players
GET players/<playerid> players?q=(id:<id>)
GET roster/<team_name> players?q=(team:<team_name>)
GET players/<position> players?q=(position:<position_abbr>)
Type Paramter Options Note
GET active false/true Players signed to a team or practice squad, default true
GET history false/true Include history object within each player object

By default, only active players, signed to a team and/or on the practive squad, are returned.

The roster method is provided for convenience, and allows either team id or team name as the second url paramter.

Responses

200:

{
	"players":[
		{
			"lastname": <player_lastname:String>,
			"firstname": <player_firstname:String>,
			"number": <player_number:Int>
			"nickname": <player_nickname:String>,
			"position": <position_abbr:EnumString>,
			"team": <team_name:String>,
			"status": <player_status:EnumString>,
			"depth": <depth_number:Int>,
			"starter": <starter_boolean:Bool>,
			"draftNumber": <draft_position:Int>,
			"draftYear": <draft_year:Int>,
			"yearsActive": <years_active:Int>,
			"gamesPlayed": <games_played:Int>,
			"college": <college_name:String>,
			"retired": <retirement_year:Int>
		},
		{...}
	]
}

player_status: ACTIVE, INACTIVE, PRACTICE, IR, PUP

position_abbr: QB, RB, FB, WR, TE,OL, C, G, LG, RG, T, LT, RT,K, KR, OW,DL, DE, DT, NT,LB, ILB, OLB, MLB,DB, CB, FS, SS, S, P, PR

null will be returned for any value with untrusted or incomplete data. 0 is a valid value, as expected (for instance, practice squad players have 0 games played, but are active players).

sports-api's People

Contributors

cmoore4 avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.