GraphQL Endpoint returns 400
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
.
but it should work since I don't have any problems running the query from the endpoint http://localhost:8000/graphql-dev
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:
first, i changed the request to GET (since in
graphql
,query
is forGET
andmutation
forPOST
- sorry, I missed that)
I tried the same request with postman (which didn't work) and with insomnia (which did)
with postman
with insomnia
What's weird is that if i check my django console the requests look the same.
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
add a comment |
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
.
but it should work since I don't have any problems running the query from the endpoint http://localhost:8000/graphql-dev
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:
first, i changed the request to GET (since in
graphql
,query
is forGET
andmutation
forPOST
- sorry, I missed that)
I tried the same request with postman (which didn't work) and with insomnia (which did)
with postman
with insomnia
What's weird is that if i check my django console the requests look the same.
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
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
add a comment |
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
.
but it should work since I don't have any problems running the query from the endpoint http://localhost:8000/graphql-dev
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:
first, i changed the request to GET (since in
graphql
,query
is forGET
andmutation
forPOST
- sorry, I missed that)
I tried the same request with postman (which didn't work) and with insomnia (which did)
with postman
with insomnia
What's weird is that if i check my django console the requests look the same.
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
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
.
but it should work since I don't have any problems running the query from the endpoint http://localhost:8000/graphql-dev
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:
first, i changed the request to GET (since in
graphql
,query
is forGET
andmutation
forPOST
- sorry, I missed that)
I tried the same request with postman (which didn't work) and with insomnia (which did)
with postman
with insomnia
What's weird is that if i check my django console the requests look the same.
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
django graphql postman graphene-python
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
add a comment |
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
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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