0
votes

For example I want to query something like this,

>hercules= g.V().has('name','hercules')
>hercules.values()
>hercules.bothE()

How do I send those query to gremlin-server using REST ?

1

1 Answers

2
votes

You can either separate each line with semicolons:

$ curl "http://localhost:8182?gremlin=x=100-1%3Bx-10"
{"requestId":"17bebb7e-3e99-4001-b33a-feca5b39b44f","status":{"message":"","code":200,"attributes":{}},"result":{"data":[89],"meta":{}}}

Note that with the curl statement above, the ; is urlencoded to "%3B" or you can just use newlines in a POST:

$ curl -X POST -d "{\"gremlin\":\"x=100-1\\nx - 10\"}" "http://localhost:8182"
{"requestId":"b5f28f38-e02f-4ab9-9888-3db389ff6f1c","status":{"message":"","code":200,"attributes":{}},"result":{"data":[89],"meta":{}}}