4

I am handling with Neo4j APOC triggers and i have a doubt, Can i made a trigger that when a graph or a subgraph will be change, it send a HTTP request to a extern endpoint?

CALL apoc.trigger.add('httpTrigger',"UNWIND {createdNodes} AS n
OPTIONAL MATCH path = (n)--()
WITH collect(n) + collect(path) as paths
CALL apoc.es.postRaw("http://localhost:8080","/rsd",paths) yield value return count(*)
", {phase:'before'})

Must Be something like that but instead use Elastic search pluggin use a HTTP library?

Thanks!!

Raúl Garcia
  • 282
  • 3
  • 18
  • I think that it is not difficult to write an extension for such a functional. – stdob-- Mar 20 '19 at 15:46
  • I know, I take a look the code of APOC and isn't found a such feature, and with a knowledge on dev this libray can do a ExportJson with Http, but i don't belive that anybody have a extension for that – Raúl Garcia Mar 20 '19 at 16:02

1 Answers1

0

I'm not aware of a specific APOC procedure to do a HTTP POST to upload a file, however, there are the apoc.export.json.* procedures to export a graph, query, or data to a local file or upload it to an AWS S3 bucket.

Furthermore, the apoc.load.jsonParams procedure allows to send an HTTP POST request to load data from an URL. Maybe it also works the other way around and can upload data? If not, that might still be a good starting point for a custom procedure for HTTP uploads.

zirkelc
  • 1,451
  • 1
  • 23
  • 49
  • 3 Years ago, jajaja really I don't remember why I want to do that, I think was to create subgraphs views and populate differently databases to make queries of the subgraph without thinking in middleware modifications, at final I used projected subgraphs, but really that options was more cool than using this apoc – Raúl Garcia Sep 07 '22 at 10:35