Learn about the POST endpoint for creating a new quote. Address needed functions to implement PUT and DELETE, and challenge yourself to implement the endpoints for these functions.
- [Instructor] As with the reads, the writes in Ruby…are very straightforward.…Let's go over the post, we'll make the put together,…and then, I'll challenge you to make a delete.…First, the post.…The methods, or verbs, in Ruby are exactly…what you'd expect, no funny stuff.…Post is post, and we're working with the quotes endpoint.…Remember that the name spacing makes it…so that this maps to API quotes.…Just like in the random endpoint, we grab the quote…with the largest index number, but this time,…we're going to increment it by one to create…a known good index number.…
We'll use the JSON function to create an object…from the post body.…Just like we always do we'll send back a 400…with a message if there's no content.…I'll pause here a moment and point out that Ruby uses…parentheses, square brackets, and braces slightly different…than other languages, so pay close attention to which…is which when working with it.…Also, note that the if then block still stops at an end.…I've found myself trying to use if do end before…
- 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.