GRANDstack starter - Using Postman API to get data from GraphQL


(Sander Biesmans) #1

HI guys,

I am trying to get GRANDstack working with Postman, but I am still a newbie with regard to setting up these kind of applications. So I completed the 'Using The Neo4j-GraphQL Plugin With Neo4j Desktop' tutorial on Youtube (link: https://www.youtube.com/watch?v=U8ZGVx1NmQg ).

I am running a Neo4j 3.4.6 instance in Windows using the ZIP-file and Command Prompt (so I am not using the Browser), and I added the GraphQL 3.4.0.1 plugin (and also the APOC and Algo plugins). I loaded the Movie db into Neo4j. Next to this, I installed the GRANDstack starter, and I added some Schema's to the graphql-schema file. I am able to receive data using the Playground on the endpoints http://localhost:4000/ and http://localhost:7474/graphql/.

From this point on I am trying to use Postman to receive data from one of these GraphQL endpoints. I use POST and an Authentication header. Everytime I post a request as body, Postman gives a 500 Internal Server Error with 'POST body missing. Did you forget use body-parser middleware?'. Does somebody has an idea how to get Postman working with GraphQL? I looked through many pages of content but nothing seems to work.

Thanks in advance :)


(Sander Biesmans) #2

I was able to receive data using Postman without doing major changes. I found this Stackoverflow thread which contains the answer: https://stackoverflow.com/questions/42520663/how-to-send-graphql-query-by-postman. At first I was sending the query body as below (similar to the Playground), but this was not the right way to do it.

{ Movie {
    title
    released
	    } 
}

The correct way to send the query as body in Postman is:

{"query":"{ Movie { title released } }"}


(Michael Hunger) #3

Yes it's a JSON payload in the body.

You can also use GET requests with a ?query= parameter