Im using triying to connect my projecto to a Neo4j DB and I can do it when I do a GET request, and using the same code (changing GETMethod for POSTMethod) I can´t do it.
It´s my code:
String name = "xxx"; String password = "xxx";
String authString = name + ":" + password;
byte[] authEncBytes = Base64.encodeBase64(authString.getBytes());
String authStringEnc = new String(authEncBytes);
HttpMethod method = null;
HttpClient client = new HttpClient();
//String url = "http://localhost:7474/db/data/relationship";
String url = "http://localhost:7474/db/data/cypher";
method = new PostMethod( String.format(url));
method.addRequestHeader(new Header("Content-Type", "application/json; charset=UTF-8"));
method.addRequestHeader("Authorization", "Basic "+ authStringEnc);
method.setQueryString("{\"query\" : \"MATCH (x{id:'123'})-[r]->(n) RETURN n.name, r.status\",\"params\" : { }}");
try {
client.executeMethod(method);
But there is a HttpException.
Is my first time with Rest and Neo4j.
Someone can help me?
Thanks.