Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use ArangoDB graph API from a C application

Tags:

rest

c

arangodb

I'm trying to implement a C application that retrieves data from ArangoDB using REST and the graph API, but when I try to create a graph I get the message:

{"error":true,"code":501,"errorNum":9,"errorMessage":"unknown path '_api/graph'"}

I can successfully use the document API to insert documents but the graph API doesn't work.

like image 554
Mario A Prado Romero Avatar asked Dec 18 '25 20:12

Mario A Prado Romero


1 Answers

In ArangoDB 1.1, this error is expected, because ArangoDB 1.1 does not yet have the graph API at /_api/graph.

It should work with ArangoDB 1.2. The current version of ArangoDB can be retrieved via either

arangod --version

or

curl -X GET http://127.0.0.1:8529/_api/version

(IP address and/or port may need to be adjusted)

If the server reports a version number less than 1.2, then the graph API is not yet available. If the server reports a version number of at least 1.2, then please try accessing the URL via cURL:

curl -X POST --dump - --data '{"vertices":"myVertices","edges":"myEdges","_key":"myGraph"}' http://127.0.0.1:8529/_api/graph

This should return something non-HTTP 501 result, e.g.:

HTTP/1.1 201 Created
server: triagens GmbH High-Performance HTTP Server
connection: Keep-Alive
content-type: application/json; charset=utf-8
content-length: 137

{"graph":{"_id":"_graphs/myGraph","_rev":"12347803","_key":"myGraph","vertices":"myVertices","edges":"myEdges"},"error":false,"code":201}
like image 102
fceller Avatar answered Dec 21 '25 10:12

fceller