# REST Connectors to call other GraphQL APIs?

**URL:** https://community.apollographql.com/t/rest-connectors-to-call-other-graphql-apis/8625
**Category:** Connectors
**Tags:** connectors
**Created:** [February 24, 2025, 10:19pm UTC](https://community.apollographql.com/t/rest-connectors-to-call-other-graphql-apis/8625 "2025-02-24T22:19:52Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Jonathan\_Wondrusch](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/jonathan_wondrusch/32/5538_2.png) [@Jonathan\_Wondrusch](https://community.apollographql.com/u/Jonathan_Wondrusch)
#### Post date: [February 24, 2025, 10:19pm UTC](https://community.apollographql.com/t/rest-connectors-to-call-other-graphql-apis/8625/1 "2025-02-24T22:19:52Z")

</div>

Is it possible to use REST connectors to make calls to other GraphQL APIs?

I was attempting experimenting with this, and conceptually it seems like it should work, but I’m repeatedly running into `Invalid body` errors when trying to structure the request using `http.body` in my `@connect` setup.

Example:

```auto
type MyType {
  id: ID!
  name: String
}

type Query {
  myType(id: ID!): MyType
    @connect(
      source: "other-graphql-service"
      http: {
        POST: "/graphql"
        body: """
        query: myQuery(id: $args.id) { id }
        """
      }
      selection: """
        ... omitted
      """
    )
}

```

---

<div class="post-metadata">

### Author: ![Jonathan\_Wondrusch](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/jonathan_wondrusch/32/5538_2.png) [@Jonathan\_Wondrusch](https://community.apollographql.com/u/Jonathan_Wondrusch)
#### Post date: [February 24, 2025, 10:59pm UTC](https://community.apollographql.com/t/rest-connectors-to-call-other-graphql-apis/8625/2 "2025-02-24T22:59:34Z")

</div>

Solved!

The answer is to use literals ([docs](https://www.apollographql.com/docs/graphos/schema-design/connectors/mapping#literal-values)):

```auto
type MyType {
  id: ID!
  name: String
}

type Query {
  myType(id: ID!): MyType
    @connect(
      source: "other-graphql-service"
      http: {
        POST: "/graphql"
        body: """
        $({
            query: "query ($id: ID!) {
                myField(id: $id) {
                    id
                    name
                }
            }",
            variables: {
              id: $args.id
            }
        })
        """
      }
      selection: """
        ... omitted
      """
    )
}

```

---

<div class="post-metadata">

### Author: ![shanemyrick](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/shanemyrick/32/5474_2.png) [@shanemyrick](https://community.apollographql.com/u/shanemyrick)
#### Post date: [February 26, 2025, 11:08pm UTC](https://community.apollographql.com/t/rest-connectors-to-call-other-graphql-apis/8625/4 "2025-02-26T23:08:14Z")

</div>

Interesting, glad you could get this working. What is the use case for using the Router to make the HTTP request and selection mapping rather than instead composing the subgraph in like a regular GraphQL server. Is it mostly for type renaming?

---

<div class="post-metadata">

### Author: ![Jonathan\_Wondrusch](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/jonathan_wondrusch/32/5538_2.png) [@Jonathan\_Wondrusch](https://community.apollographql.com/u/Jonathan_Wondrusch)
#### Post date: [February 27, 2025, 1:48am UTC](https://community.apollographql.com/t/rest-connectors-to-call-other-graphql-apis/8625/5 "2025-02-27T01:48:31Z")

</div>

This particular subgraph was the result of schema generated from protobuf annotations and the output wasn’t meeting the subgraph federation spec yet.

This approach allowed us to validate some questions earlier in our development cycle. The eventual goal would be federation.

---

<div class="post-metadata">

### Author: ![andywgarcia](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/andywgarcia/32/5651_2.png) [@andywgarcia](https://community.apollographql.com/u/andywgarcia)
#### Post date: [April 2, 2025, 9:18pm UTC](https://community.apollographql.com/t/rest-connectors-to-call-other-graphql-apis/8625/6 "2025-04-02T21:18:51Z")

</div>

I am about to do this same thing. I’ll be in touch with results!

---

<div class="post-metadata">

### Author: ![Dan\_Boerner](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/dan_boerner/32/5748_2.png) [@Dan\_Boerner](https://community.apollographql.com/u/Dan_Boerner)
#### Post date: [April 4, 2025, 5:17pm UTC](https://community.apollographql.com/t/rest-connectors-to-call-other-graphql-apis/8625/7 "2025-04-04T17:17:35Z")

</div>

Hi @Jonathan_Wondrusch, was this just an exploration or do you have plans to put this into prod?
