This week, Yelp introduced the ability to query its API data through GraphQL, a graph query language. GraphQL support allows developers to search for the exact data sought after without the need for multiple API requests. For instance, pulling the name of users who have written reviews on a business could be done through a single, simple query (a process that requires multiple API calls directly through a REST API).
To introduce Yelp developers to GraphQL, Yelp published an Intro to GraphQL. The Yelp Fusion API alone (like all APIs), are somewhat limited in that endpoints are specifically defined with set requests and responses. Accordingly, queries directly through the API may or may not match a particular user's usage pattern. GraphQL gives developers a new level of flexibility to match individual, custom requests.
Basic usage of GraphQL starts with a string, the query document, which is sent to the server to process and request data. Yelp's GraphQL implementation currently includes three queries: search, business, and reviews. While the query tells the server its action path, fields (Objects or Scalars) are used to identify the specific data to return. For more information, check out Yelp's Basic Usage guide.
In addition to GraphQL support, Yelp launched a new Yelp Developer Beta Program. Currently, the only component within the program is GraphQL, but Yelp expects new content and features to be added in the next few months. Join the program to enable GraphQL. Keep in mind, GraphQL remains in beta for the time being, so its stability cannot be guaranteed.