REST API not working


I hv installed Grakn DB, ran some basic graql cmds from console and also using the Visualiser tool to execute queries.

However, could not execute queries in any of the methods : REST API / Nodejs Client / Python client
GET http://localhost:4567/kb/graql HTTP/1.1
Accept-Encoding: gzip,deflate
Accept: application/graql+json
Host: localhost:4567
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)

url : http://localhost:4567
resource : /kb/graql
query : ?query=‘match $x isa person; get;’&keyspace=grakn&infer=false

Does not give any results in SOAP UI or curl cmd (same works in visualizer)

Node JS client (after doing npm install grakn):
The basic import fails:

const GraknGraph = require(‘grakn’);
function Graph(uri = DEFAULT_URI , keyspace = DEFAULT_KEYSPACE){
SyntaxError: Unexpected token =
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:374:25)
at Object.Module._extensions…js (module.js:417:10)
at Module.load (module.js:344:32)
Python client (after installing pip install grakn):

import grakn
Traceback (most recent call last):
File “”, line 1, in
File “/home/anirban/anaconda3/lib/python3.5/site-packages/grakn/”, line 1, in
from grakn.client import Client, GraknError
File “/home/anirban/anaconda3/lib/python3.5/site-packages/grakn/”, line 7
_HEADERS: Dict[str, str] = {‘Accept’: ‘application/graql+json’}
SyntaxError: invalid syntax

Can someone help me. Using Ubuntu Linux 16.04, Java openjdk version “1.8.0_151”


Hi @anirban,

what version of Grakn are you using?


If you are using the version >= 1.0 you should issue a POST request to localhost:4567/kb/{keyspace}/graql (change {keyspace} with the name of keyspace you want to query) and the body of the request should be the query you want to execute, in your case it would be match $x isa person; get;.


It looks like you are trying to run your JS client in an environment that is not compatible with ES6 (ECMAScript2015), that is why the default value for uri parameter is giving you an error. The JS client is supposed to be used in a NodeJS environment, it will not work from Browser environment (as you would need to transpile it to vanilla JS).

Maybe @felix can help with Python client.



Excellent, that worked. Thanks Marco.
I am using v 1.1, I think I was not giving the uri resource properly in the POST request.

Pls ignore the python part now, will let you know if I need it.

Thanks again.