0

I need to use Rest API to issue a merge query to execute for neo4j database. I am trying to refer the Neo4J manual, but it only defines for the case of creating nodes, relationships not executing queries of the like.

What needs to be done to execute a merge query? Is there any examples in the web? Thanks!!!

EDIT: I tried to use the following

 String response = resource.accept( MediaType.APPLICATION_JSON_TYPE )
                        .entity( query, MediaType.APPLICATION_JSON_TYPE )
                        .post( String.class );

With query = "{\"query\":\"MERGE (n:Person) RETURN n\"}", It creates the node

But when I try to add a property to the node like the following

  query = "{\"query\":\"MERGE (n:Person{name:"JRapid"}) RETURN n\"}"

I encountered the following error -

  Caused by: com.sun.jersey.api.client.UniformInterfaceException: POST http://localhost:7474/db/data/cypher returned a response status of 500 Internal Server Error

Is there any other way to specify the properties while issuing merge command in REST API?

1 Answer 1

1

You should find a detailed error message in the response or logs

Double escape your quotes around the name or use single quotes

Better use parameters

And try to use the transactional endpoint

From Mobile, so w/o code or links

Sign up to request clarification or add additional context in comments.

1 Comment

You do need to use parameters with transactional endpoints: docs.neo4j.org/chunked/stable/cypher-parameters.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.