Can I post my queries directly to engine via a REST api?


#1

Hi,

I need to execute many small Graql queries against my database and wondered if there is a REST API I can directly contact rather than going through the Graql shell to avoid any overhead?

Stefan


#2

Hi Stefan,

This is not officially documented you but the java docs are fairly self explanatory in the code. Check out the RemoteShellController class for details to see what is going on. The endpoint is: localhost:4567/shell/match and you can try this example to see how it works:

localhost:4567/shell/match?graphName=grakn&query=match $x isa person; limit 5;

Best,

Sheldon


#3

Jumping ahead to late May, 2017, what is the status of the REST API? I’ll explain why: I would like to write my own HTTP client to talk to a Grakn cluster because I cannot mix a GPL client with my Apache code. Should be trivial, right?

It’s not trivial given the current state of the documentation. The graph query is documented as
/graph/graphql/ (then what?)
http://localhost:4567/graph/match?graphName=grakn&query=match%20%24x%20isa%20person%3B%20limit%205%3B
doesn’t work, but perhaps the graphName is wrong
Since it’s running in the default keyspace:
http://localhost:4567/graph/match?keyspace=grakn&query=match%20%24x%20isa%20person%3B%20limit%205%3B
still doesn’t work.

Any supplemental ideas or pointers would be greatly appreciated.
Or!!! How about making the Client in your codebase Apache2 licensed, leave the server GPL?

Cheers,

Jack


#4

I have a simple response to my own question: it is pretty simple to mimic the URIBuilder code in QueryClient and make a simple query against the example database. That works.

So, I’ll change my question by way of finding a thread where the issue is inserts.

-Jack