How would I interface Graph.cool using Delphi?
I want to build a Win32/Win64/OSX client
https://Graph.cool/ has a GraphQL (REST) API end-point.
Example: https://api.graph.cool/simple/v1/ENDPOINT
A known example of GraphQL implementation with FaceBook GraphQL is at: http://docwiki.embarcadero.com/RADStudio/Tokyo/en/REST_Client_Library
I have an example query:
mutation {
createUser(
authProvider: {
email: { email: "hello@hello.com", password: "hello"
}}
)
{
id
}
}
to create a user account.
I tried using TRestClient, but there seems to be no way to put an unstructured string query.
Snipplet from DFM:
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;
I got: a) Bad request, b) Invalid Json query.
Any ideas how I would interface to Graph.cool API?