Wave's new APIs use GraphQL to provide you flexibility to request only the data you require, and to cut down the number of requests your application needs to make.

Until recently, most web applications have published their APIs using the well-known REST model. While REST has many use cases, its main drawback is a lack of flexibility: either an endpoint returns much more data than you need, or you face making multiple calls to different endpoints to collect all the data your application requires and then merging the results. This requires more coding effort on your side, results in slower performance, and places more demands upon you to understand the system's domain to know how data should be combined. If you've ever thought there must be a better way, that might just be GraphQL.

REST has been a popular way to expose data from a server. When the concept of REST was developed, client applications were relatively simple and the development pace wasn’t nearly where it is today. REST thus was a good fit for many applications. However, the API landscape has radically changed over the last couple of years.

- from HowToGraphQL

GraphQL allows you, the developer, to query a single endpoint to grab all the data you need in one call, specifying exactly the data you would like to retrieve and nothing more. The shape of a GraphQL call mirrors the shape of the JSON data it returns. Once you have your client setup, making calls to GraphQL is as simple as asking for the data you'd like...

Query Response
query {
  user {
    id
    lastName
    defaultEmail
  }  
}
{
  "data": {
    "user": {
      "id": "VXNlcjo4NzRlNDA3NS1mNzhhLTRkNzktODhlMy01MmM1MWE5YjE4ZGI=",
      "lastName": "Smith",
      "defaultEmail": "jsmith@example.com"
    }
  }
}

If you later realize that you also need the first name you simply add it to the above query. 

 

Updated: