apollo-link-rest | Use existing REST endpoints with GraphQL | GraphQL library

 by   apollographql TypeScript Version: v0.9.0 License: MIT

kandi X-RAY | apollo-link-rest Summary

kandi X-RAY | apollo-link-rest Summary

apollo-link-rest is a TypeScript library typically used in Web Services, GraphQL, Apollo applications. apollo-link-rest has no bugs, it has no vulnerabilities, it has a Permissive License and it has medium support. You can download it from GitHub.

Use existing REST endpoints with GraphQL
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              apollo-link-rest has a medium active ecosystem.
              It has 774 star(s) with 126 fork(s). There are 48 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 28 open issues and 164 have been closed. On average issues are closed in 575 days. There are 4 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of apollo-link-rest is v0.9.0

            kandi-Quality Quality

              apollo-link-rest has no bugs reported.

            kandi-Security Security

              apollo-link-rest has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.

            kandi-License License

              apollo-link-rest is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              apollo-link-rest releases are available to install and integrate.
              Installation instructions, examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of apollo-link-rest
            Get all kandi verified functions for this library.

            apollo-link-rest Key Features

            No Key Features are available at this moment for apollo-link-rest.

            apollo-link-rest Examples and Code Snippets

            Link order
            npmdot img1Lines of Code : 9dot img1no licencesLicense : No License
            copy iconCopy
            const httpLink = createHttpLink({ uri: "server.com/graphql" });
            const restLink = new RestLink({ uri: "api.server.com" });
            
            const client = new ApolloClient({
              link: ApolloLink.from([authLink, restLink, errorLink, retryLink, httpLink]),
              // Note: htt  
            Mutations
            npmdot img2Lines of Code : 6dot img2no licencesLicense : No License
            copy iconCopy
              mutation deletePost($id: ID!) {
                deletePostResponse(id: $id)
                  @rest(type: "Post", path: "/posts/{args.id}", method: "DELETE") {
                  NoResponse
                }
              }
            
              

            Community Discussions

            QUESTION

            Apollo Client: How to query rest endpoint with query string?
            Asked 2020-Nov-14 at 09:22

            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 looking at apollo-link-rest docs and a few issues I think I'm supposed to use pathBuilder but this is not documented and I haven't been able to get it working.

            So far I've defined my query like this:

            ...

            ANSWER

            Answered 2020-Nov-14 at 09:22

            You shouldn't need to use the pathBuilder for simple query string params. You can pass your params directly as variables to useQuery then pass then directly into teh path using the {args.somearg} syntax. The issue I see is you've not defined the variables your using for you query containerHistory bu only in the query alias RESTgetUserQueries. If updated is should look like this:

            Source https://stackoverflow.com/questions/64804893

            QUESTION

            TypeScript import issues in apollo-server-express, apollo-server & apollo-cache-control
            Asked 2020-Oct-28 at 11:53

            I'm trying to update from "apollo-server": "^2.9.4" and "apollo-server-express": "^2.9.4" to 2.12.0 version in Typescript, During the build process of the app I get the following error:

            node_modules/apollo-server-express/node_modules/apollo-server-core/dist/plugin/index.d.ts:1:13

            error TS1005: '=' expected.

            1 import type { ApolloServerPlugin } from 'apollo-server-plugin-base';

            I have not found the fix for this yet, I've deleted node_modules folder and package-lock.json but still not working.

            It would be nice to have some help....

            ...

            ANSWER

            Answered 2020-Oct-28 at 11:53

            The import type syntax used in apollo-server-core isn't supported by the version of typescript that you're using (v3.6). This syntax became available from v3.8 onwards. https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export

            Update typescript and the error will disappear

            Source https://stackoverflow.com/questions/64474508

            QUESTION

            ApolloClient all values result to null when performing a mutation
            Asked 2020-Jul-12 at 13:50

            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 to work has been a complete nightmare.

            Since i have to use apollo-link-rest i have to first build my client:

            ...

            ANSWER

            Answered 2020-Jul-12 at 13:27

            According to Response transforming, apollo expects response from REST APIs like the following:

            Source https://stackoverflow.com/questions/62861231

            QUESTION

            Multiple endpoints in same query
            Asked 2020-Mar-23 at 11:39

            It works perfectly, with a single endpoint. With apollo-link-rest, I have made a client that looks like this

            ...

            ANSWER

            Answered 2020-Mar-23 at 11:39
            Using aliases

            You can (should be possible) use standard method to make similar queries - get many data (result) nurmally available as the same shape (node name). This is described here.

            Source https://stackoverflow.com/questions/60809275

            QUESTION

            How to access fetch policy in local resolver using Apollo Graphql React client
            Asked 2019-Nov-11 at 12:45

            I am creating an app using React and the Apollo Graphql client. This app must have a local resolver to retrieve data from a legacy REST API and write it to the cache.

            What I expect from this resolver is that it will first try to get the data from the local cache and then if it is not there, it will fetch it from the legacy API. However sometimes this data is also updated by other parts of my application, so in this case I would like the resolver to ignore the cache and go directly to the legacy API.

            I know that what I described above is similar to the fetchPolicies that the Apollo Client provides: the first scenario would be cache-first and the second would be network-only and I would like to use them to determine my resolver's behavior.

            However I wasn't able to find the fetchPolicy in my resolver's arguments. The resolver's function signature that I am using now is this:

            ...

            ANSWER

            Answered 2019-Nov-11 at 12:45

            I just saw this part of the Apollo client documentation that I think I missed before: https://www.apollographql.com/docs/react/data/local-state/#working-with-fetch-policies.

            Basically it says that the fetch-policies are evaluated before the resolver is called and that they work just like when calling a remote resolver.

            So, I ran some tests and by using the default policy (cache-first), my resolver is called only once and the rest of the times the result is returned directly from the cache.

            If I change the fetch-policy to network-only than my resolver function is always called.

            Source https://stackoverflow.com/questions/58788720

            QUESTION

            Can't render a nested object from an array with Apollo-link-rest and ReactJS
            Asked 2019-Apr-25 at 00:11

            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 will be much appreciated.

            ...

            ANSWER

            Answered 2019-Apr-25 at 00:11

            downloads is an array - use tool.downloads[0].copy

            Query should contain an id field in downloads - to properly cache ToolsPayloadDownloads type.

            You can check this/inspect apollo cache data/details using react dev tools.

            Source https://stackoverflow.com/questions/55839837

            QUESTION

            Apollo Client query ​Missing field __typename
            Asked 2018-Nov-15 at 19:31

            I am trying to use apollo-link-rest with the Star Wars API and I am getting some errors.

            ...

            ANSWER

            Answered 2018-Nov-15 at 19:31

            Check out what the docs have to say about typename patching.

            Your @rest directive tells the client what typename to expect for the search field, but doesn't say anything about any types inside the field's selection set. There's two ways to fix that. You can use a @type directive:

            Source https://stackoverflow.com/questions/53325787

            QUESTION

            appolo-link-rest set header
            Asked 2018-Oct-16 at 20:13

            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 app, it works perfectly fine. But not for apollo-link-rest:

            ...

            ANSWER

            Answered 2018-Oct-13 at 15:48

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install apollo-link-rest

            apollo-link, graphql, qs and graphql-anywhere are peer dependencies needed by apollo-link-rest.

            Support

            For a complete apollo-link-rest reference visit the documentation website at: https://www.apollographql.com/docs/link/links/rest.html.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries

            Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular GraphQL Libraries

            parse-server

            by parse-community

            graphql-js

            by graphql

            apollo-client

            by apollographql

            relay

            by facebook

            graphql-spec

            by graphql

            Try Top Libraries by apollographql

            apollo-client

            by apollographqlTypeScript

            apollo-server

            by apollographqlTypeScript

            react-apollo

            by apollographqlJavaScript

            apollo-ios

            by apollographqlSwift

            apollo-kotlin

            by apollographqlKotlin