JSON:API Format and Active Model Serializers Discussion
Very nice video as always, but there's an editing problem on your video. Check it between 15:00 and 17:00. You actually repeat the same thing twice, but the wordings you use is different, I guess you forgot to remove one of those when editing the video.
But anyway, great video!
Chris, what if my current API code base doesn't really in RESTful shape? Does AMS still can help?
Example of my current routes:
1. /transaction_history.json (I don't have TransactionHistory model)
2. /buy.json (I don't have Buy model)
3. /user_status.json (mixed data between User model and several other models)
I'm not using AMS now. Still using render :json => {}
approach inside my API controller.
Thanks.
AMS doesn't care about your URLs, it just takes models and turns them into JSON. You can use any routes you want. Ideally for JSON:API spec, you'll want some restful routes for the objects, but it's also fine to have routes like you mentioned for ease of use. I think of routes for concepts often, it doesn't have to be specifically for a model. For example, your routes make sense because they offer up clear endpoints for different concepts for each one.
I would love it if you would do as many tutorials on api's as possible, and I would like it if you did a tutorial on the doorkeeper gem as well.
By the way great episode!
Hi Chris. Thanks for video.
Can you tell me - why json api is better than basic json output?
Json APi has more unneeded information(big response size). It's terrible to work with Json API from JS clients, because you will need to write a normalizer for get access to data through dot(location.recordings...).
This is a really interesting question. I was thing about the same thing when I saw this much of information.
Hey Chris! What would you recommend for pagination? Using some gems or doing it from scratch? Could you also point out some great resources on the topic? Thx
I would recommend either will_paginate or Kaminari. Both work really well and only have minor API differences between the two. They both have over 13M downloads too, so they're similarly popular and I wouldn't really say one is better than the other. If you use something like Administrate or something that already depends upon one, then I'd say to just use that for your app as well.
I'll be making a video how to add the pages into the JSON api spec so you can see how that's done.
Hey Chris. Thanks for the awesome video.
I'd like to know about your courses sooner!
Would be wonderful if you add the links information in a video as mentioned in this video.
In addition, I had asked at work why they did not use this JSON Api format and they said to me that HAL and HATEOAS are better.
Do you know which are the advantages of those three ways of JSON Format?
Thanks so much for your attention.
Hugs.
Kelvin Matheus
Hi Chris, have you recorded another screencast for rendering out the links for objects as JSON:API recommends? I don't seem to have much luck finding any other tutorials on the subject. You're the closest I've found... I'd really like to figure out how to do that. Thanks!
Hi Chris, which Chrome extension are you using for viewing JSON responses?
Ukaza, I think it is this extension.
After some digging I found and chose this gem: https://github.com/jsonapi-serializer/jsonapi-serializer
Seems its fastest and still maintained.
Not sure how it will be in long run.