Apollo Link REST is a community-maintained Apollo Link that enables GraphQL clients to query existing REST APIs using GraphQL syntax. Current stable version is 0.10.0-rc.2 (release candidate). It allows prototyping, integrating with third-party REST services, and gradual migration from REST to GraphQL without a full GraphQL server. Key differentiators: works with Apollo Client, supports multiple endpoints, custom fetch, header/credential configuration, and field name normalization. Released irregularly; under active development by community.
npm install apollo-link-restNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Basic setup: create RestLink, configure ApolloClient, execute a query using @rest directive to fetch from REST API.
Upgrade @apollo/client to v4 or higher. See migration guide.
Consider using Apollo Client's built-in httpLink for GraphQL APIs. For REST, evaluate alternatives like graphql-request with custom fetch.
Order links: ApolloLink.from([restLink, httpLink])
Install qs: npm install qs
Use relative paths in the @rest directive, e.g., path: 'people/1/' not 'https://api.example.com/people/1/'
Pin to exact version or wait for stable release.
Use import { RestLink } from 'apollo-link-rest';Run npm install qs and ensure it's in package.json.
Add path: 'your/path' to the @rest directive, e.g., @rest(type: 'TypeName', path: 'resource/id')
Ensure the URI is correct and the server allows CORS. Use customFetch for proxy if needed.
Double-check import path (apollo-link-rest) and use new RestLink(...).