This project demonstrates API coding best practices using Python and FastAPI.
This project was built from examples in the book Hands-On APIs For API and Data Science.
Thanks for using the SportsWorldCentral API. This is your one-stop shop for accessing data from our fantasy football website, www.sportsworldcentral.com.
- Public API
- Getting Started
- Analytics
- Player
- Scoring
- Membership
- Terms of Service
- Example Code
- Software Development Kit (SDK)
Our API is hosted at https://fantasyfootball-api-service-9n5k.onrender.com/.
You can access the interactive documentation at https://fantasyfootball-api-service-9n5k.onrender.com/docs.
You can view the OpenAPI Specification (OAS) file at https://fantasyfootball-api-service-9n5k.onrender.com/openapi.json.
Since all of the data is public, the SWC API doesn't require any authentication. All of the the following data is available using GET endpoints that return JSON data.
Get information about the health of the API and counts of leagues, teams, and players.
You can get a list of all NFL players, or search for an individual player by player_id.
You can get a list of NFL player performances, including the fantasy points they scored using SWC league scoring.
Get information about all the SWC fantasy football leagues and the teams in them.
By using the API, you agree to the following terms of service:
- Usage Limits: You are allowed up to 2000 requests per day. Exceeding this limit may result in your API key being suspended.
- No Warranty: We don't provide any warranty of the API or its operation.
Here is some Python example code for accessing the health check endpoint:
import httpx
HEALTH_CHECK_ENDPOINT = "/"
with httpx.Client(base_url=self.swc_base_url) as client:
response = client.get(self.HEALTH_CHECK_ENDPOINT)
print(response.json())
If you are a Python user, you can use the PySWC SDK to interact with our API. Full information is available here