Rexster curl POST multiple vertices in one JSON

117 views
Skip to first unread message

ayman shalaby

unread,
Apr 15, 2014, 12:42:54 PM4/15/14
to gremli...@googlegroups.com
Hi All,

just wonder, is it possible to curl POST  multiple vertices and/or edges in a single JSON.

curl -v -X POST -H "Content-Type:application/vnd.rexster-typed-v1+json" -d '{{"idd":"(s,TTtest12)","un":"(s,SStest12)"}, {"idd":"(s,TTtest13)","un":"(s,SStest13)"},{"idd":"(s,TTtest15)","un":"(s,SStest15)"}}'  http://localhost:8182/graphs/actorRelation3/vertices

The above command doesn't seem to be working, is it JSON formating issue?


thanks,
ayman

Stephen Mallette

unread,
Apr 15, 2014, 12:52:00 PM4/15/14
to gremli...@googlegroups.com


--
You received this message because you are subscribed to the Google Groups "Gremlin-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

ayman shalaby

unread,
Apr 15, 2014, 4:05:35 PM4/15/14
to gremli...@googlegroups.com

Thanks Stephan,


I am testing Kibble with the following comand but it doesn't seem to be working.
 curl -v -X POST -H "Content-Type:application/vnd.rexster-typed-v1+json" -d '{“tx”: [{ “_action”: “create”, “_type”: “vertex”, “_id”: 100, “k1”: “v1” }]}'  http://localhost:8182/graphs/actorRelation3/tp/batch/tx
I am getting the following error

* About to connect() to 172.26.154.150 port 8182 (#0)
*   Trying  ... connected
> POST /graphs/actorRelation3/tp/batch/tx HTTP/1.1
> User-Agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3
> Host:  :8182
> Accept: */*
> Content-Type:application/vnd.rexster-typed-v1+json
> Content-Length: 108
>
* upload completely sent off: 108out of 108 bytes
< HTTP/1.1 500 Internal Server Error
< Content-Type: application/json
< server: grizzly/2.2.16
< Access-Control-Allow-Origin: *
< Date: Tue, 15 Apr 2014 19:58:39 GMT
< Connection: close
< Content-Length: 63
<
* Closing connection #0
{"message":"Error executing transaction: null","success":false}


The GET part work well though
http://local:8182/graphs/actorRelation3/tp/batch/vertices?values=[1,2,3,4,8,10,100]

Stephen Mallette

unread,
Apr 15, 2014, 7:11:33 PM4/15/14
to gremli...@googlegroups.com
What Blueprints implementation are you using?  Any error in the rexster output on the server side?

ayman shalaby

unread,
Apr 15, 2014, 9:49:12 PM4/15/14
to gremli...@googlegroups.com
I am using rexster-server-2.4.0 but I don't know which blueprint version and below is the output of the rexster server in the debug mood.

[INFO] JuliToLog4jHandler - 1 * Server in-bound request

1 > POST http://172.26.154.150:8182/graphs/actorRelation3/tp/batch/tx

1 > user-agent: curl/7.30.0

1 > host: 172.26.154.150:8182

1 > accept: */*

1 > content-type: application/vnd.rexster-typed-v1+json

1 > content-length: 108

1 > 

{“tx”: [{ “_action”: “create”, “_type”: “vertex”, “_id”: 100, “k1”: “v1” }]}


[ERROR] BatchExtension - java.lang.NullPointerException

[WARN] GraphResource - The [tp:batch+tx] extension raised an error response.

[ERROR] JuliToLog4jHandler - Mapped exception to response: 500 (Internal Server Error)

javax.ws.rs.WebApplicationException

at com.tinkerpop.rexster.GraphResource.executeGraphExtension(GraphResource.java:313)

at com.tinkerpop.rexster.GraphResource.postGraphExtension(GraphResource.java:217)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:606)

at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)

at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)

at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)

at com.codahale.metrics.jersey.InstrumentedResourceMethodDispatchProvider$TimedRequestDispatcher.dispatch(InstrumentedResourceMethodDispatchProvider.java:30)

at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302)

at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)

at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)

at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)

at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)

at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1511)

at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1442)

at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1391)

at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1381)

at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)

at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:538)

at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:716)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:770)

at org.glassfish.grizzly.servlet.FilterChainImpl.doFilter(FilterChainImpl.java:147)

at org.glassfish.grizzly.servlet.FilterChainImpl.invokeFilterChain(FilterChainImpl.java:106)

at org.glassfish.grizzly.servlet.ServletHandler.doServletService(ServletHandler.java:252)

at org.glassfish.grizzly.servlet.ServletHandler.service(ServletHandler.java:188)

at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:164)

at org.glassfish.grizzly.http.server.HttpHandlerChain.service(HttpHandlerChain.java:196)

at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:164)

at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:175)

at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)

at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:265)

at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:200)

at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:134)

at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)

at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:78)

at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:815)

at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)

at org.glassfish.grizzly.strategies.LeaderFollowerNIOStrategy.executeIoEvent(LeaderFollowerNIOStrategy.java:102)

at org.glassfish.grizzly.strategies.AbstractIOStrategy.executeIoEvent(AbstractIOStrategy.java:88)

at org.glassfish.grizzly.nio.SelectorRunner.iterateKeyEvents(SelectorRunner.java:398)

at org.glassfish.grizzly.nio.SelectorRunner.iterateKeys(SelectorRunner.java:368)

at org.glassfish.grizzly.nio.SelectorRunner.doSelect(SelectorRunner.java:334)

at org.glassfish.grizzly.nio.SelectorRunner.run(SelectorRunner.java:264)

at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:567)

at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:547)

at java.lang.Thread.run(Thread.java:724)

[INFO] JuliToLog4jHandler - 1 * Server out-bound response

1 < 500

1 < Access-Control-Allow-Origin: *

1 < Content-Type: application/json

1 < 

{"message":"Error executing transaction: null","success":false}



Stephen Mallette

unread,
Apr 16, 2014, 6:45:40 AM4/16/14
to gremli...@googlegroups.com
seems to work with application/json as the content type.  

curl -v -X POST -d '{"tx": [{"_action": "create","_type": "vertex","_id": 100,"k1": "v1"}]}' -H "Content-Type:application/json" http://localhost:8182/graphs/emptygraph/tp/batch/tx
* About to connect() to localhost port 8182 (#0)
*   Trying 127.0.0.1... connected
> POST /graphs/emptygraph/tp/batch/tx HTTP/1.1
> User-Agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3
> Host: localhost:8182
> Accept: */*
> Content-Type:application/json
> Content-Length: 71
* upload completely sent off: 71out of 71 bytes
< HTTP/1.1 200 OK
< Content-Type: application/json;charset=UTF-8
< server: grizzly/2.2.16
< Access-Control-Allow-Origin: *
< Date: Wed, 16 Apr 2014 10:30:44 GMT
< Content-Length: 71
* Connection #0 to host localhost left intact
* Closing connection #0
{"txProcessed":1,"success":true,"version":"2.4.0","queryTime":9.259098}

Not sure why it isn't consuming the rexster custom mime type.  at the moment, I can't remember if that was a specific omission for a reason or if it's a mistake.
Reply all
Reply to author
Forward
0 new messages