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.

3 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!

3 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.