CS257 Software Design Monday, 21 April 2025 + Questions - Large files and GitHub - Videos about TCP, HTTP, APIs,... - Current assignment - Other + URLs in APIs protocol://hostname:port/path...?GET-arguments http://stearns.mathcs.carleton.edu:9007/movies?before=2010&after=2000&genre=action Sometimes a site separates the normal web pages from the API: http://whatever:9007/home.html http://whatever:9007/api/2.0/movies + REST and API design - Principles - first component of an endpoint should be a noun (right after the first slash following any API prefix like "/api/2.0") - if it's plural, you expect to get a list (of strings or dictionaries) - if it's singular you expect to get a dictionary - use HTTP verbs GET (we'll use GET, exclusively) ...DELETE, POST, PUSH,... - use HTTP error codes (404, 200,...) - use GET parameters for filtering results - [these days] output should be JSON - Questions we might want to ask a database of movies and their cast & crew - give me a list of movies with certain attributes - give me a list of movies based on a rating level and genre - give me the best movies for a year - given an actor name, give me a list of their movies - give me a list of actors with certain attributes - given a movie, give me the cast - give me a list of directors with certain attributes - give me a list of cinematographers with certain attributes - give me a list of reviews with certain attributes - give me a list of reviews of a specified movie /reviews/ /reviews?movie_id= Is one of these choices better? Why/why not? - give me a list of reviews by a specified person - give me a list of reviews from yesterday - Turning those questions into API endpoints /actors?rating= movie_id given_name? surname? name?... year_born locations of various sorts (born, live, work,...?) ... what's the best strategy for searching by name? "m" -- Meryl Streep? "s" "M" "e" "eryl" "p, m "l s" "l S" ... /movies?actors=Brad%20Pitt /movies?actors=Brad%20Pitt,George%20Clooney -- is that AND or OR duplicate names? === + Next: relational databases - tables - joins - example: books & authors