This API gives access to NFL team rosters.
This API is REST API and returns JSON.
- Endpoints
- Team Resources
GET
teamsGET
teams/:idPOST
teamsPATCH
teams/:idDELETE
teams/:id
- Player Resources
GET
playersGET
teams/:id/playersGET
players/:idGET
teams/:teamID/players/:playerIDPOST
teams/:id/playersPATCH
teams/:teamID/players/:playerIDDELETE
teams/:teamID/players/playerID
- Team Resources
- Contributors
Returns all teams as objects in teams
array as JSON.
parameters | data type | description |
---|---|---|
id | integer | unique id of team |
city | string | team city |
name | string | team nickname |
GET teams
{
"teams": [
{
"id": 1702,
"city": "buffalo",
"name": "bills",
"created_at": "2017-12-12T21:25:15.635Z",
"updated_at": "2017-12-12T21:25:15.635Z"
},
{
"id": 1705,
"city": "new york",
"name": "jets",
"created_at": "2017-12-12T21:25:15.653Z",
"updated_at": "2017-12-12T21:25:15.653Z"
},
...
}
none
Returns one team with given unique id as an object as JSON.
parameters | data type | description |
---|---|---|
id | integer | unique id of team |
city | string | team city |
name | string | team nickname |
GET teams/1705
{
"team":
{
"id": 1705,
"city": "new york",
"name": "jets",
"created_at": "2017-12-12T21:25:15.653Z",
"updated_at": "2017-12-12T21:25:15.653Z"
}
}
- 404: Team does not exist with given unique id
Create a new team and returns the id of the created team as integer via JSON.
- MUST BE AUTHORIZED TO USE THIS ENDPOINT
parameter | data type | description |
---|---|---|
city | string | team city |
name | string | team name |
POST teams
body: {
"city": "dayton"
"name": "triangles"
}
{
"id": 1735
}
- 403: Not authorized - You must have JSON Web Token to access this endpoint.
- 422: Unprocessible Entity - Invalid parameter or parameter value within post body.
Edit team name and city by passing JSON and returns edited team as object via JSON.
- MUST BE AUTHORIZED TO USE THIS ENDPOINT
parameter | data type | description |
---|---|---|
city | string | team city; e.g. "raleigh" |
name | string | team name; e.g. "robots" |
PATCH teams/1715
body: {
"city": "las vegas"
}
{
"team": {
"id": 1715,
"city": "las vegas",
"name": "raiders",
"created_at": "2017-12-12T21:25:15.683Z",
"updated_at": "2017-12-12T21:25:15.683Z"
}
}
- 403: Not authorized - You must generate and include a valid JSON Web Token to access this endpoint.
- 404: Team does not exist with given unique id
- 422: Unprocessible Entity - Invalid parameter or parameter value within post body.
Remove team from database and server returns HTTP status code 204: No Content
.
- MUST BE AUTHORIZED TO USE THIS ENDPOINT
DELETE teams/1708
// no JSON response
- 403: Not authorized - You must generate and include a valid JSON Web Token to access this endpoint.
- 404: Team does not exist with given unique id
Returns all players as array of player objects via JSON.
parameter | data type | description |
---|---|---|
id | integer | player id, unique; e.g. 203 |
team_id | integer | player team id, e.g. 21 |
name | string | player name, first and last. e.g. "John Wolfe" |
position | string | player position, e.g. "QB", "RB", "SS" |
age | number | player age, e.g. 34 |
height | string | player height, e.g. "6-5" |
weight | integer | player weight, e.g. 285 |
experience | string | player's number of years in the legaue, R denotes rookie. e.g. '7', 'R' |
college | string | player college, e.g. 'NC State' |
GET players
{
"players": [
{
"id": 21641,
"team_id": 1703,
"number": 6,
"name": "Jay Cutler",
"position": "QB",
"age": 34,
"height": "6-3",
"weight": 231,
"experience": "12",
"college": "Vanderbilt",
"created_at": "2017-12-12T21:25:15.751Z",
"updated_at": "2017-12-12T21:25:15.751Z"
},
...
]
}
Returns one player with given unique id as object via JSON
GET players/22396
{
"player": {
"id": 22396,
"team_id": 1712,
"number": 17,
"name": "Philip Rivers",
"position": "QB",
"age": 36,
"height": "6-5",
"weight": 228,
"experience": "14",
"college": "NC State",
"created_at": "2017-12-12T21:25:16.206Z",
"updated_at": "2017-12-12T21:25:16.206Z"
}
}
parameter | data type | description |
---|---|---|
id | integer | player id, unique; e.g. 203 |
team_id | integer | player team id, e.g. 21 |
name | string | player name, first and last. e.g. "John Wolfe" |
position | string | player position, e.g. "QB", "RB", "SS" |
age | number | player age, e.g. 34 |
height | string | player height, e.g. "6-5" |
weight | integer | player weight, e.g. 285 |
experience | string | player's number of years in the legaue, R denotes rookie. e.g. '7', 'R' |
college | string | player college, e.g. 'NC State' |
GET teams/17/players
{
"players": [
{
"id": 22396,
"team_id": 1712,
"number": 17,
"name": "Philip Rivers",
"position": "QB",
"age": 36,
"height": "6-5",
"weight": 228,
"experience": "14",
"college": "NC State",
"created_at": "2017-12-12T21:25:16.206Z",
"updated_at": "2017-12-12T21:25:16.206Z"
},
...
]
}
- 404: Team not found - no team associated with supplied unique ID.
Returns one player with given unique id from one team with given unique id as object via JSON.
parameter | data type | description |
---|---|---|
id | integer | player id, unique; e.g. 203 |
team_id | integer | player team id, e.g. 21 |
name | string | player name, first and last. e.g. "John Wolfe" |
position | string | player position, e.g. "QB", "RB", "SS" |
age | number | player age, e.g. 34 |
height | string | player height, e.g. "6-5" |
weight | integer | player weight, e.g. 285 |
experience | string | player's number of years in the legaue, R denotes rookie. e.g. '7', 'R' |
college | string | player college, e.g. 'NC State' |
GET teams/1/players/22396
{
"player": {
"id": 22396,
"team_id": 1712,
"number": 17,
"name": "Philip Rivers",
"position": "QB",
"age": 36,
"height": "6-5",
"weight": 228,
"experience": "14",
"college": "NC State",
"created_at": "2017-12-12T21:25:16.206Z",
"updated_at": "2017-12-12T21:25:16.206Z"
}
}
- 404: Team / Player not found - no team / player associated with supplied unique IDs.
- MUST BE AUTHORIZED TO USE THIS ENDPOINT
parameter | data type | description |
---|---|---|
name | string | player name, first and last. e.g. "John Wolfe" |
position | string | player position, e.g. "QB", "RB", "SS" |
age | number | player age, e.g. 34 |
height | string | player height, e.g. "6-5" |
weight | integer | player weight, e.g. 285 |
experience | string | player's number of years in the legaue, R denotes rookie. e.g. '7', 'R' |
college | string | player college, e.g. 'NC State' |
PATCH teams/:id
patch body: {
token: 'JWT token string'
}
{
"player": {
"id": 22396,
"team_id": 1712,
"number": 17,
"name": "Philip Rivers",
"position": "QB",
"age": 36,
"height": "6-5",
"weight": 228,
"experience": "14",
"college": "NC State",
"created_at": "2017-12-12T21:25:16.206Z",
"updated_at": "2017-12-12T21:25:16.206Z"
}
}
- 403: Not authorized. You must have JSON Web Token to access this endpoint.
Create a player with a team_id of the given unique team id in the URL
- MUST BE AUTHORIZED TO USE THIS ENDPOINT
parameter | data type | description |
---|---|---|
name | string | player name, first and last. e.g. "John Wolfe" |
position | string | player position, e.g. "QB", "RB", "SS" |
age | number | player age, e.g. 34 |
height | string | player height, e.g. "6-5" |
weight | integer | player weight, e.g. 285 |
experience | string | player's number of years in the legaue, R denotes rookie. e.g. '7', 'R' |
college | string | player college, e.g. 'NC State' |
POST teams/17/players
{
team: {
id: 11347,
}
}
- 403: Not authorized. You must have JSON Web Token to access this endpoint.
- 404: Team not found - no team associated with supplied unique ID.
Remove team with given unique id and responds with HTTP 204.
- MUST BE AUTHORIZED TO USE THIS ENDPOINT
DELETE teams/17/players/34875
{ // no json response }
- 403: Not authorized. You must have JSON Web Token to access this endpoint.
- 404: Team / player not found - no team /player associated with supplied unique ID.
- GitHub: @jenPlusPlus
- GitHub: @adammescher