Graphql API call using JSON body

Hi All,

I have a requirement to make an API POST call to a graphql endpoint. Here I need to post the body in a JSON format, if I convert it to sctring and encode it, it throws 400 error. It has to be in the below format to get the proper response.

{“query”: "mutation{ setUpUser (setUpUser : {amount: 100 redirectUrl: “” reference : “MFNT12312345” customerName : {title: “mr” firstName: “john” lastName: “smith”} customerAddress : {line1: “1” line2: “test” town: “london” postCode: “w1 1aa” county: “london” countryCode: “GB”}}) {transactionRef paymentUrl error transactionStatus}} "}

Please let me know, if there is any way I can make a successful request using elixir. The same syntax works in Postman, but if I execute it via application, HTTPoison or any other libraries accepts it to be an encoded string formats.


Can you concretely show the code you are running that fails?

I think I need to use the libraries like neuron , I am checking how to pass headers which are customized.