Explore POST for creating new items in Python/Flask. A challenge introduced in this video is to create a DELETE endpoint to remove quotes.
- [Instructor] Now that we've gotten…the read endpoint setup,…we're ready to handle put, post, and delete.…As discussed before, the list of quotes…should accept the post operation to create new items.…The endpoint for individual quotes…should accept put and delete.…The post quote is already in there…so let's take a quick look at it…down in the quote list class.…So first, we're grabbing the args from the client post body…using the parser defined at the top of the code.…In this case, we're expecting a content field…and an author field so we check those args…and return a 400 if they aren't there.…
Notice the syntax here.…If and not are bare words and and is also a bare word.…You can probably start to see…why Python is considered to be a very readable language.…Just like in the random quote functionality,…we'll grab the highest index in the database,…this time to increment it by one for use by the new quote.…That way, we're certain to have a unique index…when putting the quote in the database.…Finally, in a try block,…
- Why become a polyglot programmer?
- Exploring Node.js, Python, Perl, and Ruby code
- Building on prior knowledge to learn new programming languages
- Learning API read and write functionality in Node.js, Python, Perl, and Ruby
- Implementing API functionality in Node.js, Python, Perl, and Ruby
Skill Level Intermediate
Building APIs Using Hapi in Node.jswith Kirsten Hunter2h 23m Intermediate
1. Becoming a Polyglot
Next steps1m 19s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.