-
Notifications
You must be signed in to change notification settings - Fork 116
Rexster Mime Types
Mime types are used in the REST API to let consumers choose the format of the data they wish to receive. The format is selected by adding one or more of the following types to the Accept
header on each request.
application/json
application/vnd.rexster+json
application/vnd.rexster-typed+json
If the Accept
header is not specified, Rexster will return application/json
in its response. Both application/vnd.rexster+json
and application/vnd.rexster-typed+json
are considered custom types and can be generally applied to all requests with the exception of Extension requests, as they are capable of exposing their own specific content types.
While all three types are JSON formats, application/vnd.rexster+json
and application/vnd.rexster-typed+json
provide additional information in their responses which may be important to consumers. The application/vnd.rexster+json
type contains link information regarding configured and available extensions, specifically for the graph, vertex, and edge resource and the application/vnd.rexster-typed+json
type is the same but also includes property data type information embedded within the returned JSON.
This first request does not specify the Accept
header and therefore Rexster simply returns application/json
.
curl -v http://localhost:8182/graphs/tinkergraph/edges/11
{
"version": "0.7-SNAPSHOT",
"results": {
"weight": 0.4000000059604645,
"_id": "11",
"_type": "edge",
"_outV": "4",
"_inV": "3",
"_label": "created"
},
"queryTime": 1.225442
}
The following request to the same resource uses application/vnd.rexster+json
and Rexster therefore responds with the same result as above, but includes the list of configured extensions.
curl -v -H "Accept:application/vnd.rexster+json" http://localhost:8182/graphs/tinkergraph/edges/11
{
"version": "0.7-SNAPSHOT",
"results": {
"weight": 0.4000000059604645,
"_id": "11",
"_type": "edge",
"_outV": "4",
"_inV": "3",
"_label": "created"
},
"queryTime": 1.355568,
"extensions": [
{
"title": "evaluate an ad-hoc Gremlin script for an edge.",
"method": "GET",
"href": "tp/gremlin"
},
{
"title": "evaluate an ad-hoc Gremlin script for an edge.",
"method": "POST",
"href": "tp/gremlin"
}
]
}
This final request in the example set uses application/vnd.rexster-typed+json
and Rexster therefore responds with the same result as above, but includes embedded data types within the JSON itself.
curl -v -H "Accept:application/vnd.rexster.typed+json" http://localhost:8182/graphs/tinkergraph/edges/11
{
"version": "0.7-SNAPSHOT",
"results": {
"weight": {
"type": "float",
"value": 0.4000000059604645
},
"_id": "11",
"_type": "edge",
"_outV": "4",
"_inV": "3",
"_label": "created"
},
"queryTime": 1.25632,
"extensions": [
{
"title": "evaluate an ad-hoc Gremlin script for an edge.",
"method": "GET",
"href": "tp/gremlin"
},
{
"title": "evaluate an ad-hoc Gremlin script for an edge.",
"method": "POST",
"href": "tp/gremlin"
}
]
}