Questions tagged [apollo-link-rest]

14 questions
6
votes
2 answers

How should I query and match data from the same response in GraphQL with Apollo Client and Link Rest?

I have the following query: const getPage = gql` query Page($path: String!) { page(path: $path) @rest(type: "Page", path: "{args.path}") { blocks @type(name: Block) { name posts @type(name:…
wintercounter
  • 7,500
  • 6
  • 32
  • 46
5
votes
1 answer

Apollo Client Error | Type 'RestLink' is not assignable to type 'ApolloLink'

Now I am trying to use apolloClient with both graphql and rest api in typescript. Therefore, I applied apollo-link-rest. But I got the error below. ./node_modules/apollo-link-rest/bundle.umd.js Module not found: Can't resolve…
Pooh
  • 71
  • 1
  • 5
4
votes
2 answers

Apollo Client: can apollo-link-rest resolve relations between endpoints?

The rest api that I have to use provides data over multiple endpoints. The objects in the results might have relations that are are not resolved directly by the api, it rather provides ids that point to the actual resource. Example: For…
4
votes
2 answers

appolo-link-rest set header

EDIT: The problem described below is a problem of the api i used... not a problem with apollo. I am trying to use apollo-link-rest with a api-key set in the header. If I try to use the exact same api endpoint and set the api-key as header in Postman…
3
votes
2 answers

Apollo Client query ​Missing field __typename

I am trying to use apollo-link-rest with the Star Wars API and I am getting some errors. import { InMemoryCache } from "apollo-cache-inmemory"; import { ApolloClient } from "apollo-client"; import { RestLink } from "apollo-link-rest"; import gql…
joelnet
  • 13,621
  • 5
  • 35
  • 49
2
votes
0 answers

Getting a network error from a refetched query after a mutation lead to an ApolloError and unsubscribe the query, am i missing something?

I'm trying to implement react-apollo with apollo-link-rest, and everything seems wonderful except error handling and refetchQueries. It seems that if a query goes in error, than got unsubscribe. I tried to do almost everything: use…
Saltatempo
  • 61
  • 7
2
votes
0 answers

Apollo react: combining rest and graphql with link-state

I am trying to use REST endpoints to post data and GraphQL for query and fetch along with apollo-link-state. My rest endpoint is getting hit and application is getting created. But when I try to run the query to write to cache it's not hitting the…
rak1n
  • 671
  • 1
  • 8
  • 17
1
vote
1 answer

apollo-link-rest: query with dynamic fields in response

I'm requesting a Salesforce schema data. It has a format res = { Id: { name, type, label }, IsDeleted: { type, name, label }, MasterRecordId: { type, name, label }, ...and so on } So, fields are dynamic. In queries.js I'm trying to describe…
1
vote
2 answers

How to get error body using React Apollo Link Rest

I am creating an React app using Apollo Graphql and I am having some trouble with the Apollo Link Rest. The problem is that in the middle of my app I have to make a REST request, however this request can be sucessful and return a status code = 200…
Felipe
  • 6,312
  • 11
  • 52
  • 70
0
votes
0 answers

How to limit the number of items of nested array in Apollo graphQL / Apollo Link Rest?

I Have a query like this ` query { doctors @rest(type: "doctors", path: "/doctors/") { Result { Id FirstName LastName Items (limit: 10) { id title } } } ` I…
DAMAR225
  • 1,993
  • 1
  • 13
  • 22
0
votes
1 answer

Apollo Client: How to query rest endpoint with query string?

I'm using Apollo to call a rest endpoint that takes variables from query string: /api/GetUserContainers?showActive=true&showSold=true I'm having trouble figuring out how to pass variables to the query, so it can then call the correct url. From…
samzmann
  • 2,286
  • 3
  • 20
  • 47
0
votes
1 answer

ApolloClient all values result to null when performing a mutation

I started using ApolloClient and i must say, the documentation is horrible. My application will use GraphQL, but the login needs to be done using a simple POST request to /login providing the username and password, as formdata. And man, getting that…
Toerktumlare
  • 12,548
  • 3
  • 35
  • 54
0
votes
1 answer

Can't render a nested object from an array with Apollo-link-rest and ReactJS

Trying to get the nested data downloads.copy to render on page. I see the data with Apollo Client Dev Tools but won't render to page. I've searched through the apollo-link-rest issues. I'm sure this is some syntax problem - or not. Any help/insight…
Tina
  • 85
  • 2
  • 9
0
votes
1 answer

Send plain text request body with apollo-link-rest

I am trying to send a POST request to an endpoint that takes a application/x-www-form-urlencoded Content-Type and a plain text string for the form data with the apollo-link-rest module and am having the hardest time. In cURL form the request I want…
jasonmerino
  • 3,220
  • 1
  • 21
  • 38