#130 API CRUD endpoints

08/05/2023
rest api api development rails api
  • 0:00 Recap of what we already have
  • 2:00 scaffold Posts, belong to user
  • 3:45 WTF Format JSON
  • 5:05 WTF JBUILDER
  • 6:08 cURL request to access posts
  • 7:07 Access Posts controller within our API
  • 11:42 API controller authorization - user can access only his own posts
  • 13:30 fix ActiveRecord::RecordNotFound error
  • 14:59 CREATE via API, fix InvalidAuthenticityToken
  • 16:40 UPDATE via API. Importance of strong params
  • 18:17 DESTROY via API
  • 19:20 cleanup API controller
  • 19:36 summary

Create an API Controller where you can LIST, SHOW, CREATE, UPDATE, DESTROY records.

Episode source code: https://github.com/corsego/130-api-crud-endpoints/commit/de101248398714ec367cf3c4dfad7e95c8373d4f
Based on this blogpost: https://blog.corsego.com/rails-api-bearer-authentication

0:00 Recap of what we already have
2:00 scaffold Posts, belong to user
3:45 WTF Format JSON
5:05 WTF JBUILDER
6:08 cURL request to access posts
7:07 Access Posts controller within our API
11:42 API controller authorization - user can access only his own posts
13:30 fix ActiveRecord::RecordNotFound error
14:59 CREATE via API, fix InvalidAuthenticityToken
16:40 UPDATE via API. Importance of strong params
18:17 DESTROY via API
19:20 cleanup API controller
19:36 summary

0
Join the conversation
Sign in to leave comments and save lessons to your watchlist.
We collect your email address, name and username to create your account. We do not share your email address with anyone else.