REST call is not working


Srinivas Rao <vasu...@...>
 

I followed the steps described in the documentation to access the JanusGraph using REST calls. But I am getting error message as follows. 

curl -XPOST -Hcontent-type:application/json -d '{"gremlin":"g.V().count()"}' http://xxxxxx:8182

{"message":"No such property: g for class: Script2","Exception-Class":"groovy.lang.MissingPropertyException"}


Can some one help me to fix this issue.


Thanks, Srinivas.


Robert Dale <rob...@...>
 

Did you use the snapshot recently released?

Verify that conf/gremlin-server/gremlin-server.yaml has a graph section like:

graphs: {
  graph: conf/gremlin-server/janusgraph-cassandra-es-server.properties}

Then verify that the graph property file exists and has a graph defined, e.g.:

gremlin.graph=org.janusgraph.core.JanusGraphFactory

Verify that conf/gremlin-server/gremlin-server.yaml has a script section like:

scriptEngines: {
  gremlin-groovy: {
    imports: [java.lang.Math],
    staticImports: [java.lang.Math.PI],
    scripts: [scripts/empty-sample.groovy]}}

Finally, verify that scripts points to an existing file and that the script contains something that sets the global graph traversal:

def globals = [:]
// define the default TraversalSource to bind queries to - this one will be named "g".
globals << [g : graph.traversal()]


Otherwise using a clean, distribution snapshot, update conf/gremlin-server/gremlin-server.yaml to use HttpChannelizer

sed -i 's/WebSocketChannelizer/HttpChannelizer/g' conf/gremlin-server/gremlin-server.yaml

Then start janusgraph.

./bin/janusgraph.sh start

Run your query:

curl -XPOST -Hcontent-type:application/json -d '{"gremlin":"g.V().count()"}' http://localhost:8182

Result:

{"requestId":"0cfae44d-d1b1-4dec-b36a-ab94ec600f09","status":{"message":"","code":200,"attributes":{}},"result":{"data":[0],"meta":{}}}


On Friday, March 24, 2017 at 11:34:45 AM UTC-4, Srinivas Rao wrote:
I followed the steps described in the documentation to access the JanusGraph using REST calls. But I am getting error message as follows. 

curl -XPOST -Hcontent-type:application/json -d '{"gremlin":"g.V().count()"}' http://xxxxxx:8182

{"message":"No such property: g for class: Script2","Exception-Class":"groovy.lang.MissingPropertyException"}


Can some one help me to fix this issue.


Thanks, Srinivas.