Created
December 30, 2015 21:06
-
-
Save smartmic/eaa95cb143c126cb11b6 to your computer and use it in GitHub Desktop.
HTTP/REST Interface from Julia to Neo4j Database
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Requests, HttpCommon, Codecs | |
db_key = "neo4j" | |
db_secret = "neo4j" | |
# create authentication | |
function enc_credentials(db_key::String, db_secret::String) | |
bearer_token_credentials = "$(encodeURI(db_key)):$(encodeURI(db_secret))" | |
return(base64(bearer_token_credentials)) | |
end | |
response = post(URI("http://localhost:7474/db/data/transaction/commit"), | |
"{\"statements\":[{\"statement\":\"CREATE (p:Person {name:{name},born:{born}}) RETURN p\",\"parameters\":{\"name\":\"Keanu Reeves\",\"born\":1964}}]}"; | |
headers = {"Authorization" => "Basic $(enc_credentials(db_key,db_secret))", "Content-Type" => "application/json"}, | |
) | |
return response |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment