title: Delphi with Graph.cool API?
body: <p>How would I interface Graph.cool using Delphi?</p>
  
  <p>I want to build a Win32/Win64/OSX client</p>
  
  <p><a href="https://Graph.cool/" rel="nofollow noreferrer">https://Graph.cool/</a> has a GraphQL (REST) API end-point.</p>
  
  <p>Example:
  <a href="https://api.graph.cool/simple/v1/ENDPOINT" rel="nofollow noreferrer">https://api.graph.cool/simple/v1/ENDPOINT</a></p>
  
  <p>A known example of GraphQL implementation with FaceBook GraphQL is at:
  <a href="http://docwiki.embarcadero.com/RADStudio/Tokyo/en/REST_Client_Library" rel="nofollow noreferrer">http://docwiki.embarcadero.com/RADStudio/Tokyo/en/REST_Client_Library</a></p>
  
  <p>I have an example query:</p>
  
  <pre><code>mutation {
    createUser(
      authProvider: { 
        email: { email: "hello@hello.com", password: "hello" 
        }}
    )
    {
      id
    }
  }
  </code></pre>
  
  <p>to create a user account.</p>
  
  <p>I tried using TRestClient, but there seems to be no way to put an unstructured string query. </p>
  
  <p>Snipplet from DFM:</p>
  
  <pre><code>var
    RESTRequest1: TRESTRequest;
    RESTRequest1 := TRESTRequest.Create(Self);
    RESTRequest1.Name := 'RESTRequest1';
    RESTRequest1.AcceptEncoding := ' ';
    RESTRequest1.Client := RESTClient1;
    RESTRequest1.Method := rmPOST;
    with RESTRequest1.Params.Add do begin 
      name := 'query';
      Options := [poAutoCreated];
      Value := '{ "query": "mutation { createUser(authProvider: { email: { email: \"hello@hello\", password: \"hello\" } }) { id } }" }';
      ContentType := ctAPPLICATION_JAVASCRIPT;
    end;
    with RESTRequest1.Params.Add do begin 
      name := ' id ';
      Options := [poAutoCreated];
    end;
    RESTRequest1.Response := RESTResponse1;
    RESTRequest1.SynchronizedEvents := False;
  </code></pre>
  
  <p>I got: a) Bad request, b) Invalid Json query.</p>
  
  <p>Any ideas how I would interface to Graph.cool API?</p>