Permalink
Browse files

Added route for creating relationships between nodes.

  • Loading branch information...
1 parent cf7e082 commit 9582aab46c0459b090c513c66f2aa6bc855c03b2 @Romiko committed Jan 29, 2012
Showing with 11 additions and 0 deletions.
  1. +11 −0 gremlin-endpoint.rb
View
@@ -60,6 +60,17 @@
end
end
+post '/db/data/node/:nodeid/relationships' do
+ data = request.body.read;
+ begin
+ data = JSON.parse(data)
+ rescue
+ end
+ data = data unless data.kind_of?(Hash)
+ rest["/db/data/node/" + params[:nodeid] + "/relationships"].post data.to_json,
+ {:accept=>"application/json",:content_type=>"application/json"}
+end
+
get '/db/data/node/:nodeid/relationships/:relationships' do
response = RestClient.get ENV['NEO4J_URL'] + '/db/data/node/' + params[:nodeid] + '/relationships/' + params[:relationships], {:content_type => :json, :accept => :json}
ReplaceHostNameWithProxyHostName(response)

0 comments on commit 9582aab

Please sign in to comment.