Live data from Hacker News

Introducing Yelp's GraphQL API

engineeringblog.yelp.com

21–30 of 54 posts

Re: Introducing Yelp's GraphQL API

#21
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 before further publicizing it. Hope to take lessons from Yelp and others on best practices with it.

Re: Introducing Yelp's GraphQL API

#22

Not sure if anyone at Yelp reads HN but looks like a bunch of the sample queries are broken. I'm not familar enough with GraphQL on how to fix them. https://www.yelp.com/developers/graphql/query/reviews

It looks like the error on that page is asking you to create an API account and authenticate. So maybe not an error in the API itself, but an oversight in documentation?

Once you create an account you will also get an error about needing a business_id. But using the pre-filled example or sample above it won't work.

Re: Introducing Yelp's GraphQL API

#24

Nice to see some technical leadership from Yelp. A tight partnership with 3rd party developers may be a nice way to go up against Google My Business and Bing Places. If anyone from Yelp engineering is reading this, I'd love to see a major player get behind some standard for uniquely identifying places on which we could join public and private place-based datasets. I like mapcodes: http://www.mapcode.com/

Their api doesn't support querying for more than 3 reviews, have ids on reviews, or for any business to authorize your app to enable inline replies. All of which can be done is Google My Business and Facebook apis so I don't think this is anything more than catchup.

Re: Introducing Yelp's GraphQL API

#25

Not sure if anyone at Yelp reads HN but looks like a bunch of the sample queries are broken. I'm not familar enough with GraphQL on how to fix them. https://www.yelp.com/developers/graphql/query/reviews

Hey! I fixed reviews so the example should work now and pushed out a change to the developer site to fix a broken example I noticed.

Re: Introducing Yelp's GraphQL API

#26
Love seeing a public GraphQL API out there - my company is very interested in also using GraphQL to power the new version of our API sometime this year, it looks like an awesome way to bring customizable endpoints to the end user.

Is there any information on challenges developers have found with GraphQL out there?

Re: Introducing Yelp's GraphQL API

#27

Earlier quoted context omitted.

Not really. GraphQL mostly provides an alternative to REST when you want to select specific fields and traverse down into relationships with a single query. The closest you could get is the users who rated the business: business(id: "garaje-san-francisco") { reviewers { rating user { name } } } If Yelp wanted to enable that use case, they would add a field to Business like `related_businesses` like: business(id: "gar…

You can recurse in GraphQL so if they added a `favorited_businesses` field to `user` then it would be possible. Something like this: business(id: "garaje-san-francisco") { reviewers { rating user { name favorited_businesses { id name } } } }

GraphQL looks cool, kind of fancy but simpler way to do some complex SQL without the SQL.

Using the business as the root query would be a bit cumbersome, but more like:

   business(id: "garaje-san-francisco") {
    
      reviewers {

      user {

        name

        favorited_businesses

        favorited_businesses(name: "garaje")

      }

    }

  }

If they provide user queries, then something like:

      user {

        name

        favorited_businesses

        favorited_businesses(name: "garaje")

      }

Re: Introducing Yelp's GraphQL API

#30

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.
Post reply on HN