2

Hi I have a Graphql Request which I want to send using RestClient, can anyone please give me suggestion How can I do it I want something like in this form

response = RestClient.post("http://localhost:3000/graphql", default_headers,payload) Because in below method I am using Graphlient::Client which is using a lot of the memory.

def make_request(id)
   client = Graphlient::Client.new("http:localhost:3000/graphql", headers: {
            'Authorization': "API #{@api_key}"
          })
   query = <<-GRAPHQL
      query ($input: FilterInput, $first: Int) {
  filterLocations(input: $input, first: $first) {
    edges {
      cursor
      node {
       id
       attributes{
          name
          value
        }
        photos{
          fileSize
          id
          name
        }
        business{
         start
         end
        }
        city
        country
GRAPHQL
variables = {
  "first": 1,
  "input": {
    "attributes": [
      {
        "name": "test",
        "value": [
         id
        ]
      }
    ]
  }
}
end
Puja Garg
  • 251
  • 3
  • 11
  • Send a `POST` request with up to three properties `query`, `variables` and `operationName`. [More info](https://graphql.org/learn/serving-over-http/#post-request) – Herku Jul 20 '20 at 16:07

0 Answers0