Is it possible for neo4j to "auto create" node properties from a JSON/REST endpoint? For example, I can hit a uri and see the resulting JSON. I want to create a node based on one of the key value pairs, which is easy enough. Now there may be 20-30 more key:value pairs at that UNWIND level. Some of which I ultimately want as nodes, some of which I ultimately want as properties. I have gone through and created cypher to do this, but what I am finding is that what I may code for one request, breaks on another request. The value may be null (which can be fixed with a CASE statement) or the key may not exist in another request (which I can kinda fix with do.when). The problem becomes, I don't want to write 30+ CASE or do.when statements as there may be other key/value pairs that I am not aware of, but would still like to capture.
So I am asking if there is a way to create the initial node, then for however many key/value pairs exist for that request, set node properties for each one of those keys (matching the name of that key)
for each value without hard-coding it?
After the API data is gathered, I would then create new nodes/relationships based on the properties using simple MATCH/WHERE/CREATE cypher. I know it probably seems 6 one way/half dozen the other, but I want to make sure that the initial data is captured without intensive troubleshooting on the import.
I will try to be more clear. You hit the API endpoint do your various UNWINDs to get a few levels deep to get to the level that has the info. It may look like this for the first hit
The only for sure common key is endpoint.id, and I have no idea how many endpoint.xxx exist or what they are even named as new ones tend to pop-up, but I want to capture that information when the endpoint is hit and do my clean-up later. I want the cypher to account for the presence of unknown (to me) "props".
I am trying to do this is in straight cypher or apoc to eliminate the need for intermediate file cleaning in a csv, or writing a python script for those who do not have python setup. I am thinking or some sort of FOREACH statement, but I haven't been able to get that to work either.
EDIT: Now that I think about it a bit more, maybe better explained as set the properties on the node using the complete "map". Maybe apoc.map.* is what I am looking for?