Bad Request for GraphQl

Hi Team,
When I send a request via Coda.io Pack, I receive this message

But I’m sending it properly

Here is my code:

 execute: async function ([], context) {
    const requestBody = JSON.stringify({
      query: `{
        user(id: "576576")) {
          followers {
            edges {
              node {
                id
              }
            }
          }
        }
      }`
    });
    let response = await context.fetcher.fetch({
      method: "POST",
      url: "https://api.producthunt.com/v2/api/graphql",
      body: requestBody,
    });
    let data = response.body;
    return data;
  },
});

Could anyone help me with this request, please?
Thank you a ton! I’ve spend 30 mins trying to figure it out where is the problem

You have an additional parenthesis there, it should be just user(id: "576576") :slight_smile:

1 Like

Wow, thank you! :smiley:

But I’m still getting the same error :frowning:

I think the problem is the way how I’m sending the query request

I started to build a POC for PH and this works just fine:

image

I’ve also tried your request in Insomnia which is a GraphQL client and it works ok.

2 Likes

This is PRO! :slight_smile:

Will try your solution!

@Leandro_Zubrezki, you are the best! I added headers as json and it worked! Closing the request, thank you!

2 Likes