Apollo Client with REST APIs
You got it right, you can use Apollo Client with REST APIs.

Motivation
Having already been convinced of using GraphQL APIs and happily using Apollo Client in consuming them in React applications, I have been falling back to a more traditional approach in consuming REST APIs; Redux async actions.
The problem is:
- Apollo Client has removed the need for Redux in consuming GraphQL APIs
- Apollo Client Local State Management has removed the need for Redux in managing local state
- Having a one-off solution for consuming REST APIs is unsatisfactory
- Learning Redux has a fairly steep learning curve and coding with it is a bit verbose; typically referred to having a lot of boilerplate code
In a random conversation with a colleague of mine earlier this week, I learned that we can use Apollo Client to consume REST APIs.
Even better, it is a feature that is supported by the Apollo team.
apollo-link-rest
The feature is apollo-link-rest; interesting that while it is clearly a supported library by the Apollo team, it is hard to find.
Some of the highlights:
- Much like apollo-link-state, for managing local state, apollo-link-rest can interoperate with Apollo Client consuming a GraphQL API
- Queries to REST APIs share the same syntax as to GraphQL APIs
- apollo-link-rest supports both queries and mutations
- apollo-link-rest supports, out of the box, REST APIs that are “normal”, i.e., return JSON objects (or arrays of them) with a unique identifier (id); something like the following todos endpoint. At the same time, it has features that allow one to transform other APIs into this format
An Example
The following example, available for download, uses the todos API provided by JSONPlaceholder; both querying and mutating (adding) todos.

Observations:
- The example is written in TypeScript; so there is a bit of extra complexity that can be removed if only using JavaScript
- The official documentation was super helpful in creating the query; less helpful in creating the mutation
- Apollo Client Developer Tools continues to work as expected
Wrap Up
That is about it; just wanted to share the concept and a simple concrete example.