Using GraphQL Clients

This will build upon the previous setup and creation of an express GraphQL cloud server. The server has a mounted HTTP API endpoint using GraphQL and express. The Ubuntu virtual machine is in the cloud and there is an initial data set to test with.

I send my initial request via curl as follows:

curl -X POST \
-H "Content-Type: application/json" \
-d '{"query": "{ hello }"}' \
http://138.68.62.109:4000/graphql/

I now get the following response:

{"data":{"hello":"Welcome to your new Express GraphQL Server Jason!"}}%

There are a few different ways in which the data can be accessed. Above I used curl. In the previous article I showed how the GraphiQL interface can be used and here I am showing how this can even be accessed from a regular browser. I just navigate to the HTTP API endpoint I have created and enter the following:



And from this query above the following data below is returned:


So now everything is working with hardcoded values but next I will show how to use variables in client code to construct more complex and dynamic requests. I can actually just use HTTP requests as the transport layer supporting my requests and then invest the time to setup my GraphQL client to handle more variables as the data becomes increasingly complex. For simple queries this is the best and fastest method to get up and running.

Comments

Popular posts from this blog

Automated Exploitation of a Bluetooth vulnerability that leads to 0-click code execution

Sniffing GSM traffic on a private cellphone network

Raspberry Pi WiFi Honeypot 🍯