0

Is it possible to use AQL query language via REST API to make graph queries?

Thanks.

2 Answers 2

1

Yes, HTTP Query cursor API is the right API to do this. It allows executing AQL queries via HTTP.

Example (with a non-graph query):

curl        \
  -X POST   \
  --dump -  \
  "http://localhost:8529/_db/_system/_api/cursor" \
  --data '{"query":"FOR u IN users RETURN u","count":true}'

You can put your AQL query string (using graph functions) into the query attribute of the request. Bind parameters are optional. If used, they can be put into the optional bindVars attribute of the request:

curl        \
  -X POST   \
  --dump -  \
  "http://localhost:8529/_db/_system/_api/cursor" \
  --data '{"query":"FOR u IN users FILTER u.name == @name RETURN u","bindVars":{"name":"foobar"}}'
Sign up to request clarification or add additional context in comments.

Comments

0

Great! But this AQL bellow works fine in the AQL editor, but not it the REST.

curl -X POST --dump - http://localhost:8529/_db/database/_api/cursor --data '{query:LET from = (FOR p IN products FILTER p.name == "p1" RETURN p._id) LET to=(FOR p IN products FILTER p.name == "p2" RETURN p._id) INSERT { _from: from[0], _to: to[0], type: "RELATED" } INTO productsedge}' HTTP/1.1 400 Bad Request Server: ArangoDB Connection: Keep-Alive Content-Type: application/json; charset=utf-8 Content-Length: 82 {"error":true,"errorMessage":"expecting attribute name","code":400,"errorNum":600}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.