Here it is explained how I can interact with a Gremlin Server using its REST API. With the following command I execute the rather simple 100-1
script.
curl -X POST -d "{\"gremlin\":\"100-1\"}" "http://localhost:8182"
What I want is to instead of using an inline script, define it in say, script.groovy
.
I can make it work for this case defining a variable with the entire script:
GROOVY_LOAD_DATA_SCRIPT=$(<script.groovy)
curl -X POST -d "{\"gremlin\":\"${GROOVY_LOAD_DATA_SCRIPT}\"}" "http://localhost:8182"
But as soon as I start moving beyond one-liners that command breaks:
{
"message": "body could not be parsed"
}
$ cat /tmp/fooprintln "Hello " + 'World!'1+2$ echo "{\"gremlin\":$(python -c 'import json, sys; print(json.dumps(sys.stdin.read()))' < /tmp/foo)}"{"gremlin":"println \"Hello \" + 'World!'\n1+2\n"}
--
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-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/f25e98d5-b70f-4996-8a49-17966205678b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/CA%2Bf9seVEsxV33TpyuWM0Vkz2YR8-smoLiudNnGu2VSZtECe72Q%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/CAA-H43_1%3DO5J_EwYyF2zWyP8qfbfN8o%3DyCqoTnrjGxtBEuwosQ%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/CA%2Bf9seU8gUbCCvgANqv2wYXZh_5s28%2BY06CnrUpafhEQYFQFgg%40mail.gmail.com.
GROOVY_SCRIPT=$(tr -d "\n\r\t"<query.groovy)
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/f25e98d5-b70f-4996-8a49-17966205678b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/CA%2Bf9seVEsxV33TpyuWM0Vkz2YR8-smoLiudNnGu2VSZtECe72Q%40mail.gmail.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.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/CAA-H43_1%3DO5J_EwYyF2zWyP8qfbfN8o%3DyCqoTnrjGxtBEuwosQ%40mail.gmail.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.