GraphQL Endpoint returns 400












1















I have a django app built with graphene and I have a problem running a simple POST query for the GraphQL endpoint, it keeps returning a 400 Bad request syntax.



enter image description here



but it should work since I don't have any problems running the query from the endpoint http://localhost:8000/graphql-dev



enter image description here



and I can't see any issues in the way I send the postman request.
I looked online for suitable solutions but couldn't find any that would help.



Any help/tips would be greatly appreciated.



EDIT:
I still didn't manage to see why I'm having this issue with postman, but here are some observations:




  1. first, i changed the request to GET (since in graphql, query is for GET and mutation for POST - sorry, I missed that)



  2. I tried the same request with postman (which didn't work) and with insomnia (which did)




    • with postman
      enter image description here


    • with insomnia
      enter image description here





What's weird is that if i check my django console the requests look the same.



enter image description here



EDIT2: okay, I figured it out...removing the Content-Type application/json did the trick. Now it works with postman as well.










share|improve this question

























  • What is your Content Type header? application/json?

    – Daniel Rearden
    Jan 3 at 5:11











  • @DanielRearden yes

    – KeykoYume
    Jan 3 at 8:40











  • Might be a postman issue, I tried the same request with insomnia and it worked

    – KeykoYume
    Jan 3 at 8:57






  • 1





    @KeykoYume, It happened to me, environment variable is causing the issue sometimes, directly we cannot see the parameter. Two things to check 1)remove env. variables and pass url and variables as it is. OR 2)Open Postman console while calling the request and check URL and request parameters

    – Div
    Jan 3 at 9:15


















1















I have a django app built with graphene and I have a problem running a simple POST query for the GraphQL endpoint, it keeps returning a 400 Bad request syntax.



enter image description here



but it should work since I don't have any problems running the query from the endpoint http://localhost:8000/graphql-dev



enter image description here



and I can't see any issues in the way I send the postman request.
I looked online for suitable solutions but couldn't find any that would help.



Any help/tips would be greatly appreciated.



EDIT:
I still didn't manage to see why I'm having this issue with postman, but here are some observations:




  1. first, i changed the request to GET (since in graphql, query is for GET and mutation for POST - sorry, I missed that)



  2. I tried the same request with postman (which didn't work) and with insomnia (which did)




    • with postman
      enter image description here


    • with insomnia
      enter image description here





What's weird is that if i check my django console the requests look the same.



enter image description here



EDIT2: okay, I figured it out...removing the Content-Type application/json did the trick. Now it works with postman as well.










share|improve this question

























  • What is your Content Type header? application/json?

    – Daniel Rearden
    Jan 3 at 5:11











  • @DanielRearden yes

    – KeykoYume
    Jan 3 at 8:40











  • Might be a postman issue, I tried the same request with insomnia and it worked

    – KeykoYume
    Jan 3 at 8:57






  • 1





    @KeykoYume, It happened to me, environment variable is causing the issue sometimes, directly we cannot see the parameter. Two things to check 1)remove env. variables and pass url and variables as it is. OR 2)Open Postman console while calling the request and check URL and request parameters

    – Div
    Jan 3 at 9:15
















1












1








1








I have a django app built with graphene and I have a problem running a simple POST query for the GraphQL endpoint, it keeps returning a 400 Bad request syntax.



enter image description here



but it should work since I don't have any problems running the query from the endpoint http://localhost:8000/graphql-dev



enter image description here



and I can't see any issues in the way I send the postman request.
I looked online for suitable solutions but couldn't find any that would help.



Any help/tips would be greatly appreciated.



EDIT:
I still didn't manage to see why I'm having this issue with postman, but here are some observations:




  1. first, i changed the request to GET (since in graphql, query is for GET and mutation for POST - sorry, I missed that)



  2. I tried the same request with postman (which didn't work) and with insomnia (which did)




    • with postman
      enter image description here


    • with insomnia
      enter image description here





What's weird is that if i check my django console the requests look the same.



enter image description here



EDIT2: okay, I figured it out...removing the Content-Type application/json did the trick. Now it works with postman as well.










share|improve this question
















I have a django app built with graphene and I have a problem running a simple POST query for the GraphQL endpoint, it keeps returning a 400 Bad request syntax.



enter image description here



but it should work since I don't have any problems running the query from the endpoint http://localhost:8000/graphql-dev



enter image description here



and I can't see any issues in the way I send the postman request.
I looked online for suitable solutions but couldn't find any that would help.



Any help/tips would be greatly appreciated.



EDIT:
I still didn't manage to see why I'm having this issue with postman, but here are some observations:




  1. first, i changed the request to GET (since in graphql, query is for GET and mutation for POST - sorry, I missed that)



  2. I tried the same request with postman (which didn't work) and with insomnia (which did)




    • with postman
      enter image description here


    • with insomnia
      enter image description here





What's weird is that if i check my django console the requests look the same.



enter image description here



EDIT2: okay, I figured it out...removing the Content-Type application/json did the trick. Now it works with postman as well.







django graphql postman graphene-python






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 3 at 9:51







KeykoYume

















asked Jan 2 at 23:17









KeykoYumeKeykoYume

61221128




61221128













  • What is your Content Type header? application/json?

    – Daniel Rearden
    Jan 3 at 5:11











  • @DanielRearden yes

    – KeykoYume
    Jan 3 at 8:40











  • Might be a postman issue, I tried the same request with insomnia and it worked

    – KeykoYume
    Jan 3 at 8:57






  • 1





    @KeykoYume, It happened to me, environment variable is causing the issue sometimes, directly we cannot see the parameter. Two things to check 1)remove env. variables and pass url and variables as it is. OR 2)Open Postman console while calling the request and check URL and request parameters

    – Div
    Jan 3 at 9:15





















  • What is your Content Type header? application/json?

    – Daniel Rearden
    Jan 3 at 5:11











  • @DanielRearden yes

    – KeykoYume
    Jan 3 at 8:40











  • Might be a postman issue, I tried the same request with insomnia and it worked

    – KeykoYume
    Jan 3 at 8:57






  • 1





    @KeykoYume, It happened to me, environment variable is causing the issue sometimes, directly we cannot see the parameter. Two things to check 1)remove env. variables and pass url and variables as it is. OR 2)Open Postman console while calling the request and check URL and request parameters

    – Div
    Jan 3 at 9:15



















What is your Content Type header? application/json?

– Daniel Rearden
Jan 3 at 5:11





What is your Content Type header? application/json?

– Daniel Rearden
Jan 3 at 5:11













@DanielRearden yes

– KeykoYume
Jan 3 at 8:40





@DanielRearden yes

– KeykoYume
Jan 3 at 8:40













Might be a postman issue, I tried the same request with insomnia and it worked

– KeykoYume
Jan 3 at 8:57





Might be a postman issue, I tried the same request with insomnia and it worked

– KeykoYume
Jan 3 at 8:57




1




1





@KeykoYume, It happened to me, environment variable is causing the issue sometimes, directly we cannot see the parameter. Two things to check 1)remove env. variables and pass url and variables as it is. OR 2)Open Postman console while calling the request and check URL and request parameters

– Div
Jan 3 at 9:15







@KeykoYume, It happened to me, environment variable is causing the issue sometimes, directly we cannot see the parameter. Two things to check 1)remove env. variables and pass url and variables as it is. OR 2)Open Postman console while calling the request and check URL and request parameters

– Div
Jan 3 at 9:15














0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54014434%2fgraphql-endpoint-returns-400%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54014434%2fgraphql-endpoint-returns-400%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

'app-layout' is not a known element: how to share Component with different Modules

android studio warns about leanback feature tag usage required on manifest while using Unity exported app?

WPF add header to Image with URL pettitions [duplicate]