Minimal Groovy neo4j client

@Grab(‘org.codehaus.groovy.modules.http-builder:http-builder:0.7.2’)
import groovyx.net.http.RESTClient
import groovy.json.JsonSlurper

def authToken = ‘neo4j:password’.bytes.encodeBase64().toString()
def auth = “Basic: $authToken”.toString()
// send Cypher statement to Neo4j Server
def client = new RESTClient( ‘http://localhost:7474’, ‘application/json’ )
client.defaultRequestHeaders.’Authorization’ = auth

def body = “””{
“statements” : [ {
“statement” : “CREATE (wordsworth:Author {firstname:’William’, lastname: ‘Wordsworth’})”
} ]
}”””
def resp = client.post( path : ‘/db/data/transaction/commit’, body : body )

println resp.data.toString()