Live data from Hacker News

Introducing Yelp's GraphQL API

engineeringblog.yelp.com

31–40 of 54 posts

Re: Introducing Yelp's GraphQL API

#32

Can someone explain why GraphQL was designed to be non-JSON? Seems like a stupid decision, unless I'm missing something.

Your question doesn't really make sense. You are specifying the data that you want back from the API. What gain would be using key:value syntax be in this situation? The request would just be littered with `"requested_data": true` which is just wasteful.

Equally important to note: the result of a GraphQL query is valid JSON.

Re: Introducing Yelp's GraphQL API

#34

It's really validating to see Yelp putting a GraphQL API out there as there were a number of questions on whether or not GraphQL made sense as we approached introducing a new API. We (Kiva) also just released our own GraphQL API, though very much in "Beta" it is available at https://api.kivaws.org/graphql with some general API info at https://build.kiva.org We're still working on documentation among other things befo…

I'm not going to lie, this is the first time I've heard of Kiva. Can you talk about some of the reasons why you chose GraphQL and what some of the technical problems that you've solved that were drastically easier in GraphQL vs REST? I'm trying to decide if it's worthwhile internally to consider a GraphQL API build out, but I'd like to get others perspectives on some of the problems that have been significantly easier to solve, and what was surprisingly more difficult.

Re: Introducing Yelp's GraphQL API

#35
post #32

Earlier quoted context omitted.

Your question doesn't really make sense. You are specifying the data that you want back from the API. What gain would be using key:value syntax be in this situation? The request would just be littered with `"requested_data": true` which is just wasteful.

Equally important to note: the result of a GraphQL query is valid JSON.

Totally. Just assumed OP meant the request, as the responses are very clearly valid JSON.

Re: Introducing Yelp's GraphQL API

#38

Another option for providing a queryable RESTful API interface is OData http://www.odata.org/

I did some OData a few years ago when it was hip & trendy in .NET land. Right when Facebook announced GraphQL I got a deja vu - our problem with OData was that while the query syntax was awesome, making a server endpoint for it was super hard (unless you happened to be 100% entity framework and wanted all REST data to CRUD straight into the DB and back - which is of course never the case).

I now see people on HN have very similar complaints about GraphQL - how its power and flexibility makes making a performant and secure GraphQL backend significantly harder than making an oldschool REST API backend.

We ended up regex-parsing the OData query fragments that our app happened to use and made it work. We felt dirty for months after, though.

Does anyone have experience with both? Is GraphQL any better than OData in server-side implementability?

Re: Introducing Yelp's GraphQL API

#39

Is it possible to do more complex requests in GraphQL, like getting the favorite venues of people that favored "Garaje" or is it left to the API provider?

Yes.. Its left to the API provider. Try https://learngraphql.com gives a very good idea of what graphql is. Way better than reading the official documentation or spec. Once I went through it, made up my mind that our API as a service product should support Graphql. Note: I am in no way related to the site.. It is free and I finally actually understood what graphql is in 15 mins.

Thanks for sharing that link, looks really good. I'll be going through it after work.
Post reply on HN