0

When I execute this command :

curl -X POST

 -H "Content-Type:application/json" 

 -d '{\"statements\" : [ 

 {\"statement\" : \"MATCH n OPTIONAL MATCH n-[r]-m

   DELETE n,r\"} ]}' 

 http://localhost:7474/db/data/transaction/commit

I get this result :


curl: (7) couldn't connect to host
curl: (3) [globbing] illegal character in range specification at pos 2
curl: (7) couldn't connect to host
curl: (6) Couldn't resolve host '"MATCH'
curl: (6) Couldn't resolve host 'n'
curl: (6) Couldn't resolve host 'OPTIONAL'
curl: (6) Couldn't resolve host 'MATCH'
curl: (3) [globbing] error: bad range specification after pos 4
curl: (6) Couldn't resolve host 'DELETE'
curl: (3) [globbing] unmatched close brace/bracket at pos 5
curl: (3) [globbing] unmatched close brace/bracket at pos 1
{"results":[],"errors":[]}

Why I get this problem ? knowing that I have a neo4j database ...

ista9im
  • 79
  • 2
  • 10

3 Answers3

2

You need to put the whole thing on one single line or use a backslash at the end of each line. See my reply on a different question regarding cURL and Neo4j.

Community
  • 1
  • 1
Stefan Armbruster
  • 39,465
  • 6
  • 87
  • 97
  • 1
    Yes, I already put this command on one single line : `curl -X POST -H "Content-Type:application/json" -d '{\"statements\" : [{\"statement\" : \"MATCH n OPTIONAL MATCH n-[r]-m DELETE n,r\"} ]}' http://localhost:7474/db/data/transaction/commit` and I get always the same problem – ista9im Jan 08 '15 at 21:35
  • try to omit the backslashes before the double quotes. – Stefan Armbruster Jan 08 '15 at 22:25
  • I used this : `curl -X POST -H "Content-Type:application/json" -d '{"statements" : [{"statement" : "MATCH n OPTIONAL MATCH n-[r]-m DELETE n,r"} ]}' http://localhost:7474/db/data/transaction/commit` and I get this result : curl: (7) couldn't connect to host curl: (3) [globbing] illegal character in range specification at pos 2 curl: (7) couldn't connect to host curl: (3) [globbing] error: bad range specification after pos 27 curl: (3) [globbing] unmatched close brace/bracket at pos 1 {"results":[],"errors":[] } – ista9im Jan 08 '15 at 23:03
0

You can try in this way:

    data='{
        "statements": [
            {
                "statement": "MATCH n OPTIONAL MATCH n-[r]-m DELETE n,r"
            }
        ]
      }'

curl -X POST 'http://localhost:7474/db/data/transaction/commit'  \
-H 'Content-Type: application/json' \
-d "$data"
0
curl -X POST -H accept:application/json \
-H content-type:application/json \
-H Authorization:"Basic <your auth>" \
http://localhost:7474/db/data/transaction/commit \
-d "{\"statements\": [{\"statement\": \"MATCH n OPTIONAL MATCH n-[r]-m DELETE n,r\"}]}"

This one works great; covers auth, query, and accept content.

fin
  • 77
  • 1
  • 3