Table Of Contents

Commands graph:titan/query/gremlin

Executes a Gremlin query.

POST /v1/commands/

GET /v1/commands/:id

Request

Route

POST /v1/commands/

Body

name:

graph:titan/query/gremlin

arguments:

graph : <bound method AtkEntityType.__name__ of <trustedanalytics.rest.jsonschema.AtkEntityType object at 0x7f9e68702050>>

<Missing Description>

gremlin : unicode

The Gremlin script to execute.

Examples of Gremlin queries:

g.V[0..9] - Returns the first 10 vertices in graph g.V.userId - Returns the userId property from vertices g.V(‘name’,’hercules’).out(‘father’).out(‘father’).name - Returns the name of Hercules’ grandfather


Headers

Authorization: test_api_key_1
Content-type: application/json

Description

Executes a Gremlin query on an existing graph.

Notes

The query does not support pagination so the results of query should be limited using the Gremlin range filter [i..j], for example, g.V[0..9] to return the first 10 vertices.


Response

Status

200 OK

Body

Returns information about the command. See the Response Body for Get Command here below. It is the same.

GET /v1/commands/:id

Request

Route

GET /v1/commands/18

Body

(None)

Headers

Authorization: test_api_key_1
Content-type: application/json

Response

Status

200 OK

Body

dict

List of query results serialized to JSON and runtime of Gremlin query in seconds. The list of results is in GraphSON format(for vertices or edges) or JSON (for other results like counts). GraphSON is a JSON-based format for property graphs which uses reserved keys that begin with underscores to encode vertex and edge metadata.

Examples of valid GraphSON:

{ \"name\": \"lop\", \"lang\": \"java\",\"_id\": \"3\", \"_type\": \"vertex\" }
{ \"weight\": 1, \"_id\": \"8\", \"_type\": \"edge\", \"_outV\": \"1\", \"_inV\": \"4\", \"_label\": \"knows\" }

See https://github.com/tinkerpop/blueprints/wiki/GraphSON-Reader-and-Writer-Library