OrientDB graph operations via REST API

1.2k views Asked by At

Is there any example how to make graph operations with orientDB via REST API?

Is it possible to use SQL OrientDB language via REST API to make graph queries?

Thanks.

2

There are 2 answers

0
pembeci On

Yes, there is built-in support for this. You can create persistent server side functions (a la stored procedures in other RDBMS) in either Java or Javascript (via the interface at Orient Studio). Here is the related manual page. Then you can call them from SQL, other functions or as a REST request.

To give an example:

http://localhost:2480/function/demo/sum/3/5

will call the function sum defined in database demo with parameters 3 and 5. These functions are capable of updating your database also but you need to make POST requests for calling such functions and set your content type as application/json.

As for examples, unfortunately most of OrientDB manual currently just announces some feature and gives you only very basic examples. You need to dig deeper at other places (like orient-db tag here or OrientDB's own user mailing list) to find meaningful examples which cover greater use cases.

If you are going to use Javascript check this post to understand what is available to you as an API for writing your functions.

0
Anthony Blatner On

Yep, you can perform graph queries through the REST API.

For example, you can traverse edges to return data with the following request: GET http://localhost:2480/query/ComputerStore/sql/SELECT expand(out(‘Components’)) from 23:1

Here is a tutorial illustrating many different queries: https://medium.com/@anthonyblatner/orientdb-http-rest-api-904947dcf14d