Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
08-31-2022 05:10 PM - edited 08-31-2022 05:19 PM
Howdy,
I have a cypher query inside a Node .post using call apoc.load.json($myNeo4jParam) yield value.
When I run this query I get an error Neo4jError: Expected parameter(s): myNeo4jParam. So my apoc call is not using my Neo4j database :param myNeo4jParam.
I realize I can just put the URL I want to hit here, but was hoping to use the :param, though I guess the more I think about it, I'm hard-coding either way?
How do I differentiate from a parameter passed from my client and wanting to use a :param that is in my Neo4j data?
Solved! Go to Solution.
09-01-2022 09:00 AM - edited 09-01-2022 09:02 AM
You are correct. The 'param' is only available in the browser. In fact, it goes away when the window is closed. You will need to pass your parameter in the request. You just need to follow the format. Here is an example http request body:
{
"statements": [
{
"statement": "match(n:Item{key:$key}) return n.name as name",
"parameters": {"key":212}
}
]
}
You could also use the Neo4j JavaScript driver to execute the query directly.
08-31-2022 08:29 PM - edited 08-31-2022 08:31 PM
Can you provide the code?
I assume you are making a request via http since you are ‘posting’. If so, did you provide your request in the format outlined here:
https://neo4j.com/docs/http-api/current/actions/query-format/
it has a place to define your parameters.
When you referenced ‘:param’, are you referring to the neo4j desktop parameters?
09-01-2022 08:51 AM
Thanks @glilienfield,
Yes I'm referring to the :param that can be created in Neo4j browser (I think I'm realizing that this :param exists solely for use in the browser/desktop)...
The fuller code trying to call the Neo4j :param is...
I think the answer is No, but... Is there a way to tell Nodejs to use the Neo4j :param, not a const {param} sent from the client?
Many Thanks!
09-01-2022 09:00 AM - edited 09-01-2022 09:02 AM
You are correct. The 'param' is only available in the browser. In fact, it goes away when the window is closed. You will need to pass your parameter in the request. You just need to follow the format. Here is an example http request body:
{
"statements": [
{
"statement": "match(n:Item{key:$key}) return n.name as name",
"parameters": {"key":212}
}
]
}
You could also use the Neo4j JavaScript driver to execute the query directly.
09-01-2022 09:07 AM
Thanks @glilienfield,
RE: 'Deleting :params', I just posted the question to your answer in a new post, so your answer won't be buried in this separate 'param usage' topic.
09-01-2022 09:05 AM
Here is a reference to the docs on the HTTP request format:
https://neo4j.com/docs/http-api/current/actions/query-format/
All the sessions of the conference are now available online