Thank you. That was the key!
Am Montag, 13. Juli 2015 01:25:37 UTC+2 schrieb Avik Sengupta:
>
> I think the issue is you have the second argument ("grant_type=client_
> credentials") as the data for the post, and then the "json=..." argument
> also as data for the post.
>
> The API for post() is that it either takes the data as the second argument
> to the function, or as a keyword argument "data" or a keyword argument
> "json" . It has to be only one of those options.
>
> Regards
> -
> Avik
>
> On Sunday, 12 July 2015 23:41:26 UTC+1, Martin Michel wrote:
>>
>>
>> Hi there,
>> I have very little experience with Julia and want to try whether it fits
>> my needs. I want to connect to a Neo4j database and send a Cypher statement
>> with Julia, see
>> http://neo4j.com/docs/stable/cypher-intro-applications.html .
>> The authorization works fine, but I could not manage to add the *json
>> *keyword
>> (or *data*).
>> using Requests, HttpCommon, Codecs
>>
>> db_key = "neo4j"
>> db_secret = "mypasswd"
>>
>> # 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";),
>> "grant_type=client_credentials";
>> headers = {"Authorization" => "Basic
>> $(enc_credentials(db_key,db_secret))", "Content-Type" =>
>> "application/json"},
>> json = {"statements"=>[{"statement"=>"CREATE (p:Person
>> {name:{name},born:{born}}) RETURN p","parameters"=>{"name"=>"Keanu
>> Reeves","born"=>1964}}]})
>>
>> println(response)
>>
>> This results in
>> ERROR: unrecognized keyword argument "json"
>>
>