santoshbt
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: "https://my.website/home\” 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.
TIA.
First Post!
benwilson512
Can you concretely show the code you are running that fails?
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









