This is a companion discussion topic for the original entry at https://thoughtbot.com/upcase/videos/apis-http-json
How does Thoughtbot typically handle authentication with json apis?
THANK YOU SO MUCH for this weeks weekly iteration! I just feel like I got 30 minutes of private lesson from two Thoughtbot developers. So many awesome tools working with API. I had no idea that you can do stuff with Vim like that. I freaking love UPCASE! Again, thank you guys. This helped so much!
Thank you for this Video. It comes up for me at the right time ! I like the json formatting in vim.
Fantastic video! This was a great intro!
+1 this was one of my favorite Upcase videos to date!
+1 … what’s the best way to test json responses when authentication is required (devise)? Or any tutorials to get started?
Hi @thedanotto, I’m not sure I fully understand your question. What specifically are you trying to test? I think the authentication aspect would likely be separate and handled however you normally would (helper method in a controller spec to
sign_in a user, or similar).
Beyond that, I would expect that you would want to exercise your app, likely through controller specs, and make assertions about the shape of the JSON. You can do this by directly asserting against the returned JSON, or you can go a bit further if you’re using schemas. See the Validating JSON Schemas with an RSpec Matcher post on Giant Robots for a summary of this approach.
Hope this helps, but let me know if you have more specific questions.
Just came here in 2017 and have to agree with all of those above, this is my favorite video to date! I love the amount of tooling that was demonstrated in this video and will definitely be using some of it. The UI with postman has changed slightly since but I would definitely say that it’s all still relevant info. Thanks!
Just coming in to make some notes about the state of affairs for HTTP Test Applications in 2019. Postman is now an app and no longer a Chrome extension. You can visit their website here. Another really cool thing is that you can interact with their API Network.
Alternatively, if you don’t like Postman, I’ve found great success using Insomnia as my REST client. I use the free version, but like most services these days, there’s a paid tier as well. Insomnia also has a ridiculous amount of features that I haven’t even scratched the surface of yet.