Use any language and any frameworks/libraries you wish. Consult the internet as necessary.
- Generate test data consisting of a list of schools:
- each school will have an integer
id
and stringname
- you may keep the data in memory (no db required)
- each school will have an integer
- Create endpoint to list all schools
- Create endpoint to get individual school by
id
- Create endpoint to add new school
- Create endpoint to update an existing school (in this case only the
name
will get updated) - Handle looking up non-existent school
- Host API docs available at
/docs/
- n/a
GET /schools
should return all schoolsGET /schools/:schoolId
should return a single school with id = schoolId404
whenschoolId
not found (after question 6)
POST /schools
should add a new school and return the school added- also acceptable
POST /schools/:schoolId
which creates a school with a givenschoolId
- bonus if rejecting creating a duplicate school is handled
- also acceptable
PUT /schools/:schoolId
should update name associated with single school404
whenschoolId
not existing (after question 6)
- Questions 3 and 5 should return
404
- Can document using any format (including hand rolled text)
- bonus if using API documentation like swagger/openapi/raml/api blueprint
- optimizing for read heavy use
- optimizing for write heavy use
- how to handle concurrent writes/updates
- how to ensure all users get service when one bad actor may overwhelm requests
- approaches to authentication
- approaches to logging, observability
- how to create client lib / sdk
- when would you provide one? what are advantages / disadvantages?
- approaches to testing this api
The following tests assume port to be 8080.
curl http://localhost:8080/schools
curl http://localhost:8080/schools/1
curl -d '{"id": 92, "name": "School92"}' -H "Content-Type: application/json" -X POST http://localhost:8080/schools
curl -d '{"name": "School9000"}' -H "Content-Type: application/json" -X PUT http://localhost:8080/schools/1
curl -v -d '{"name": "School9000"}' -H "Content-Type: application/json" -X PUT http://localhost:8080/schools/100
curl -I -X GET http://localhost:8080/schools/999
curl http://localhost:8080/docs/