NOTEThis article introduces the minimum procedure of using Ultipa RESTful API proxy.
Command./ultipa_restful_api.exe --help
Command./ultipa_restful_api.exe --version
Command./ultipa_restful_api.exe --hosts 192.168.1.85:61095,192.168.1.87:61095,192.168.1.88:61095 -u employee -p joaGsdf -w 3
Note: -hosts, -u and -p are equivalent to --hosts, --username and --password

Other Parameters:
Parameter | Description | Default Value |
|---|---|---|
| -l --listen | The network and initial port to listen | 0.0.0.0:7001 |
| -w --workers | The number of backend workers (threads), e.g.: 5 works will be the default 7001-7005 | 0 |
| -g --graph | The graphset name | 'default' |
| -b --boost | Use SimpleCache | (Do not use cache) |
| -c --consistency | Use leader to guarantee Consistency Read | (Do not use leader) |
| -batch --batch | The batch size (number of records) of /insert/nodes and /insert/edges | 5000 |
| -d --duration | The batch insert waiting time (milliseconds) | 1000 |
| -hb --heartbeat | The heartbeat seconds for all instances | 5 |
| -sd --schema_cache_duration | The heartbeat milliseconds when acquiring schema list during insert | 5000 |
-w and -l when starting the API serviceURL.../login
JSON{ "username": "employee", "password": "joaGsdf" }
NOTEThe rest of API interfaces should all have this token value carried in Cookie in the Headers,
ultipa=<token_value>, with Content_Typeapplication/json.
URL.../uql
| Parameter | Type | Required | Description |
|---|---|---|---|
| uql | string | yes | UQL statement |
| graph | string | no | The graphset name (default value: the graphset designated when starting the API service) |
JSON{ "uql": "find().nodes({name == \"abc\"}) return count(nodes)", "graph": "test_text" }
JSON{ "Data": [ { "Name": "count(nodes)", "PropertyType": 4, "Rows": [ 2 ] } ], "Graph": "test_text", "Statistic": { "NodeAffected": 0, "EdgeAffected": 0, "TotalCost": 0, "EngineCost": 0 }, "Status": { "Message": "", "Code": 0 } }
URL.../uql/stream
| Parameter | Type | Required | Description |
|---|---|---|---|
| uql | string | yes | UQL statement |
| graph | string | no | The graphset name (default value: the graphset designated when starting the API service) |
| package_num | int | no | The number of packages to return (default value: 0, query but do not return) |
JSON{ "uql": "find().nodes({name == \"abc\"}) return nodes", "graph": "test_text", "package_num": 1 }
URL.../insert/nodes
| Parameter | Type | Required | Description |
|---|---|---|---|
| nodes | [{},{},...] (JSON), map (FORM) | yes | Node properties, must include all custom properties, do not support _uuid; in tools such as Postman, set multiple nodes with type {} as FORM parameter |
| schema | string | yes | Node schema |
| graph | string | no | The graphset name (default value: the graphset designated when starting the API service) |
| sync | bool | no | If return the status of request (default value: false). A 'true' value will induce batch waiting time (-d, --duration) when the data volume is less than batch size (-b, --batch), which will affect the insert performance |
JSON{ "nodes": [{"name":"Jason","_id":"USER001"},{"name":"Alice"}], "schema": "default", "graph": "test_text", "sync": true }
JSON{ "Msg": "Insert Nodes Success: [{\"_id\":\"USER001\",\"name\":\"Jason\"},{\"name\":\"Alice\"}]" }
URL.../insert/edges
| Parameter | Type | Required | Description |
|---|---|---|---|
| edges | [{},{},...] (JSON), map (FORM) | yes | Edge properties, must carry _from&_to and all custom properties, do not support _uuid, _from_uuid or _to_uuid; in tools such as Postman, set multiple edges with type {} as FORM parameter |
| schema | string | yes | Edge schema |
| graph | string | no | The graphset name (default value: the graphset designated when starting the API service) |
| sync | bool | no | If return the status of request (default value: false). A 'true' value will induce batch waiting time (-d, --duration) when the data volume is less than batch size (-b, --batch), which will affect the insert performance |
JSON{ "edges": [{"year":"1998", "_from":"USER001", "_to":"USER002"}], "schema": "default", "graph": "test_text", "sync": true }
JSON{ "Msg": "Insert Edges Success: [{\"_from\":\"USER001\",\"_to\":\"USER002\",\"year\":\"1998\"}]" }
Update nodes based on _id or _uuid.
URL.../update/nodes
| Parameter | Type | Required | Description |
|---|---|---|---|
| nodes | [{},{},...] (JSON), map (FORM) | yes | Node properties, must include _id or _uuid, if both are included then ignore _uuid; in tools such as Postman, set multiple nodes with type {} as FORM parameter |
| graph | string | no | The graphset name (default value: the graphset designated when starting the API service) |
JSON{ "nodes": [{"age":"35", "_id":"USER001"}, {"name":"John", "_id": "USER002"}], "graph": "test_text" }
JSON{ "Msg": "Update nodes on test_text", "SuccessCount": 2 }
Update edges based on _from&_to or _uuid.
URL.../update/edges
| Parameter | Type | Required | Description |
|---|---|---|---|
| edges | [{},{},...] (JSON), map (FORM) | yes | Edge properties, must carry _from&_to or _uuid, if both are included then ignore _uuid; in tools such as Postman, set multiple edges with type {} as FORM parameter |
| graph | string | no | The graphset name (default value: the graphset designated when starting the API service) |
JSON{ "edges": [{"_uuid":"1","_from_uuid":"2", "age":"55"}], "graph": "test_text" }
JSON{ "Msg": "Update edges on test_text", "SuccessCount": 1 }