Ask A Question

Notifications

You’re not receiving notifications from this thread.

Our First API (Example) - GoRails

Chris Oliver asked in General

Chris, at 10:33, when you open /api/v1/locations/1.json in your browser, I see that you can alternate between raw and parsed views of the json. Which plugin are you using for this?

Reply

I'm using this Chrome plugin: https://github.com/callumlo...

Reply

I am excited about the upcoming API-related videos. A particular question I have and would love to see some aspect of it discussed in the videos is this: How to return custom error codes? http://stackoverflow.com/qu...

Some suggestions I found regarding this: https://blog.rebased.pl/201...

Reply

Awesome video, Chris! I built my first api this past weekend and struggled because there were so many different sources out there. Codeschool helped me out the most. But this video would have saved me a few hours!

Reply

Brilliant! :D

Reply

I'm really excited for this. Awesome job! I love how you gradually introduce topics.

Reply

Thanks Matias! :)

Reply

Awesome video Chris, cant wait to dive deeper :) Authentication especially

Reply

The auth stuff is going to be fun. So many different methods.

Reply

Impeccable timing. I'm building an Android app with a Rails API as its back end. And just when I'm thinking "hmm I wonder how to handle authentication with APIs" in your video you say "we'll dive in talk about things like authentication... etc". :)

Reply

Can't wait for the webhooks 🙊

Reply

Great stuff Chris, 14 minutes set it all straight with how easy it is. Do you plan to do any stuff around Webhooks (generally, not just Stripe), rate limiting etc as well?

Also, any ideas when we could expect the next video around the API auth + error handling etc? :D

+1 vote for JWT!

Reply

Like building webhooks for your customers to use or consuming other service's webhooks?

First auth video will be next week. Going to be recording it tomorrow. :)

Reply

I guess I am interested in the versioning and authentication area of it.

Versioning: how to write DRY code with versioning, backwards compatibility without repeating your code.

Reply

Chris, I think that you have clearly hit a topic, that a huge group of people have interest in. As far as APIs are concerned, I believe you have material for many more videos :)

Reply

I wrote out a list of topics related to APIs and had like over 50 different episodes I could do. That's so many it could fill up the entire next year with only API content. Love it. :D

Reply

like the bonus tips at the end.

Reply

MOOOOORE!!!

Great video Chris! Can't wait to see the rest of the series!

Reply

WTH? I'm about to unsubscribe after watching this video, Rails 5 has the API ONLY MODE and this video was published on December 20, 2016. Why you are showing us the old way of creating ROR APIs???

Reply

It's just the basic introduction
I'm sure Chris aware of it

Reply

Hey Victor, please be constructive. Angry comments don't help anyone.

A common misconception like you have is that Rails API-only mode is how you should build all Rails APIs, which is flatly incorrect. In some specific cases where you don't want to render a website, you can use API-only mode to strip out most of the Rails functionality that's used for cookies and other web functionality but isn't needed for APIs. Since it removes a lot of Rails features, API-only mode should only be used when you know you really want to disable those features of Rails.

That's why it's not the default and why I'm not talking about it just yet. We will be covering this but it is not the "new way" of doing things as you claim. It is a way of doing things for a specific situation, not all situations.

So again, we're here to help each other learn these things, not shout angry comments at me about something that you believe is incorrect. It's not, and the whole reason I made this episode was to discuss how APIs are not a special thing like you claim. It's a common misunderstanding and one that we can fix if we talk about this stuff in-depth.

Next time instead of telling me I'm stupid, simply ask why I haven't talked about API-only mode and we can all have a much more constructive time together.

Reply

Chris-
Love to see file uploads through an API. If it was possible to do direct to S3 that would be the icing on the cake.
Thanks,
Dave

Reply
Emmanuel Alcime Emmanuel Alcime

cool I am interested in learning how to use a rails controller for rendering json to use as a AngularJs restful api frontend.

Reply

Chris, adding the request.format = :json works only in Application Controller.
Tried to add in the show method directly, it is not working.
Any help to understand this?

Reply

You need to change ApplicationController to ApiController in locations_controller.rb.

Reply

I had to change the coffee-script version in the Gemfile.lockfile to 1.12.2 to get bundle install to work.

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 85,376+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.