Aloni
Aloni

Reputation: 1

Rest Cypher query parameters - From .net to java

I am trying to send cypher query with parameters from .net to neo4j server with Rest method

i get this error :

Problem accessing /db/data/cypher. Reason:

    java.lang.String cannot be cast to java.util.Map

Caused by:

java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Map

This is the Code : DateTime startQueryTime = DateTime.Now; RestClient restClient = new RestClient("http://localhost:7474/db/data/cypher"); restClient.AddDefaultHeader("Accept", "application/json"); restClient.AddDefaultHeader("Content-Type", "application/json"); JObject parameters1 = new JObject(); parameters.Add("startName", "Alon"); RestRequest restRequest = new RestRequest(); ; restRequest.AddParameter("query", "START root=node:Node_Type(Type=\"Person\") where root.Person_Name = {startName} RETURN root limit 20"); restRequest.AddParameter("params", parameters1); IRestResponse restResponse = restClient.Post(restRequest);

thanks in advance.

Alon

Upvotes: 0

Views: 252

Answers (2)

Peter Neubauer
Peter Neubauer

Reputation: 6331

Examine your actual REST outgoing call and make sure the parameters map is not serialized to a String but a JSON Map structure.

Upvotes: 0

tstorms
tstorms

Reputation: 5001

The result of your query is of the form Map<String,Object> instead of String. The result map contains the node property names as keys and its values represented as objects.

Upvotes: 1

Related Questions