-
Notifications
You must be signed in to change notification settings - Fork 116
Basic REST API
This cheat sheet provides a review of the RESTful API for Rexster. Note that beyond the query parameters provided in the table below, the standard Rexster parameters rexster.offset.start
, rexster.offset.end
, rexster.returnKeys
and rexster.showTypes
also work in cases where it makes sense. The graph
is the unique name of a graph configured within Rexster. Finally base
is the base of the URI and, when running locally, is generally localhost:8182
.
returns | uri | description |
---|---|---|
graphs | http://base |
get all the graphs |
graph | http://base/graph |
get the graph |
vertices | http://base/graph/vertices |
get all vertices |
vertex |
http://base/graph/vertices/1 |
get vertex with id 1 |
edges |
http://base/graph/edges |
get all edges |
edge |
http://base/graph/edges/1 |
get edge with id 1 |
edges | http://base/graph/vertices/1/outE |
get the out edges of vertex 1 |
edges | http://base/graph/vertices/1/inE |
get the in edges of vertex 1 |
edges | http://base/graph/vertices/1/bothE |
get the both in and out edges of vertex 1 |
edges | http://base/graph/vertices/1/xxxE?_label=written_by |
get the edges of vertex 1 with edge label equal to “written_by” |
indices | http://base/graph/indices |
get all the indices associated with the graph |
elements | http://base/graph/indices/index?key=k1&value=v1 |
get all elements with k1 property equal to v1 in index
|
long | http://base/graph/indices/index/count?key=k1&value=v1 |
get a count of all elements with k1 property equal to v1 in index
|
strings | http://base/graph/indices/index/keys |
get the auto index keys of the automatic index named index (null means wildcard) |
prefixes 1 | http://base/graph/prefixes |
get the list of SailGraph prefixes |
prefix 1 | http://base/graph/prefixes/prefix |
get a specific prefix value |
returns | uri | description |
---|---|---|
vertex | http://base/graph/vertices |
create a vertex with no specified identifier |
vertex | http://base/graph/vertices/1 |
create a vertex with id 1 2 |
vertex | http://base/graph/vertices/1?k1=v1&k2=v2 |
create a vertex with id 1 and the provided properties (or update vertex properties if vertex already exists). 2 |
edge | http://base/graph/edges?_outV=1&_label=friend&_inV=2&k1=k2 |
create an out edge with no specified identifier from vertex 1 to vertex 2 labeled “friend” with provided properties. 2 |
edge | http://base/graph/edges/3?_outV=1&_label=friend&_inV=2&k1=k2 |
create an out edge with id 3 from vertex 1 to vertex 2 labeled “friend” with provided properties. 2 |
edge | http://base/graph/edges/3?k1=k2 |
update the properties of the edge with id 3 |
index | http://base/graph/indices/index?class=vertex&type=manual |
create a new manual index named index |
index | http://base/graph/indices/index?class=vertex&type=automatic&keys=[k1,k2] |
create a new automatic vertex index named index with keys k1 and k2 |
void | http://base/graph/indices/index?key=k1&value=v1&class=vertex&id=1 |
put vertex with id 1 into index at k1/v1 |
void 1 | http://base/graph/prefixes?namespace=http%3A%2F%2Fwww.ggl.com&prefix=pf |
add a new SailGraph prefix with namespace http://www.ggl.com and prefix pf |
In all cases, parameters may be POSTed on the query string, as form data or as raw JSON.
returns | uri | description |
---|---|---|
void | http://base/graph/vertices/1 |
remove vertex 1 |
void | http://base/graph/vertices/1?key1&key2 |
remove properties key1 and key2 from vertex 1 |
void | http://base/graph/edges/3 |
remove the edge with id 3 |
void | http://base/graph/edges/3?key1&key2 |
remove properties key1 and key2 from edge 3 |
void | http://base/graph |
clear the graph of all its elements and indices |
void | http://base/graph/indices/index |
drop the index named index |
void | http://base/graph/indices/index?key=k1&value=v1&class=vertex&id=1 |
remove the vertex 1 from index at k1/v1 |
void 1 | http://base/graph/prefixes/prefix |
remove the specified prefix |
1 Only applies to SailGraph
configurations.
2 Underlying graph database implementations must support the ability to assign the edge/vertex identifier. In cases where the graph database does not support the identifier (ie. Neo4j), the identifier supplied with be ignored and the graph assigned identifier will be returned in the JSON after successful graph element creation.
-
rexster.offset.start
– Expects a numeric value that represents the start point for returning a set of records and is used in conjunction withrexster.offset.end
to allow for paging of results. If used without a validrexster.offset.end
parameter specified, Rexster will return all remaining records in the set. -
rexster.offset.end
– Expects a numeric value that represents the end point for returning a set of records and is used in conjunction withrexster.offset.start
to allow for paging of results. If used without a validrexster.offset.start
parameter specified, Rexster will assume the start value to be zero. -
rexster.returnKeys
– Expects a comma separated list of property names to return in the results. Element meta-data will always be returned even ifrexster.returnKeys
are specified. If a valid value for this parameter is not specified, then all properties are returned. -
rexster.showTypes
– Expects a boolean value of “true” or “false” to determine whether the data types of the properties should be returned in the results.