Objective: Better understand APIs by building one
You will build an API using Flask. Example APIs:
We will be practicing pair programming and documentation-driven development. You'll get as far as you can during the Lab session, then continue the rest outside.
- Pair up with someone who isn't on your project team.
- This will be known as your "Lab group". Subsequent Labs will use the same people, repository, and dataset.
- Pick a dataset that has unique identifiers for each row.
- You can use a dataset from one of your projects, or pick a different one.
- You'll use a CSV as the data source to power your API.
- Don't spend too long on this step.
- Create a public repository in the
advanced-computing
organization.- Call it something like
[name1]-[name2]-api
. - Make sure to grant collaborator access to your partner.
- Call it something like
- Create a README that will describe how to use your forthcoming API.
For each step, you will:
- Document the functionality. Include:
- Options, if applicable
- Sample output
- Build it.
- Test it.
The documentation is a starting place; you can add/modify as you go.
For inspiration, check out the example.
Suggested order
Allow the user to:
- List records
- You can start with CSV or JSON output; you will implement the other later.
- Filter the data based on a particular column, such as
age=30
- Specify a
limit
andoffset
- Retrieve a single record by identifier
- Specify the output format (CSV or JSON)