Graphene Django “Must provide query string”

后端 未结 7 822
醉酒成梦
醉酒成梦 2021-01-12 06:52

I have setup a Graphene server using Django. When I run my queries through GraphiQL (the web client), everything works fine. However, when I run from anywhere else, I get th

7条回答
  •  春和景丽
    2021-01-12 07:19

    Here's how I was able to get a successful response from Postman using a graphene Django backend with a simple mutation:

    1. Set method to POST
    2. Add the URL to your graphQL endpoint, e.g. http://localhost:8000/api/
    3. Add one header -- key: "Content-Type" , value: "application/json"
    4. Set the body to "raw"
    5. Paste in your query into the body window, e.g. {"query":"{myModels {id}}","variables":"null","operationName":null}

    This sounds pretty much like what you did, so you must be close.

提交回复
热议问题