github.com/cayleygraph/cayley@v0.7.7/docs/http.md (about) 1 # HTTP Methods 2 3 This file covers deprecated v1 HTTP API. All the methods of v2 HTTP API is described in OpenAPI/Swagger [spec](https://github.com/cayleygraph/cayley/tree/87c9c341848b59924a054ebc2dd0f2bf8c57c6a9/docs/api/swagger.yml) and can be viewed by importing `https://raw.githubusercontent.com/cayleygraph/cayley/master/docs/api/swagger.yml` URL into [Swagger Editor](https://editor.swagger.io/) or [Swagger UI demo](http://petstore.swagger.io/). 4 5 ## Gephi 6 7 Cayley supports streaming to Gephi via [GraphStream](gephigraphstream.md). 8 9 ## API v1 10 11 Unless otherwise noted, all URIs take a POST command. 12 13 ### Queries and Results 14 15 #### `/api/v1/query/gizmo` 16 17 POST Body: Javascript source code of the query 18 19 Response: JSON results, depending on the query. 20 21 #### `/api/v1/query/graphql` 22 23 POST Body: [GraphQL](graphql.md) query 24 25 Response: JSON results, depending on the query. 26 27 #### `/api/v1/query/mql` 28 29 POST Body: JSON MQL query 30 31 Response: JSON results, with a query wrapper: 32 33 ```javascript 34 { 35 "result": <JSON Result set> 36 } 37 ``` 38 39 If the JSON is invalid or an error occurs: 40 41 ```javascript 42 { 43 "error": "Error message" 44 } 45 ``` 46 47 ### Query Shapes 48 49 Result form: 50 51 ```javascript 52 { 53 "nodes": [{ 54 "id" : integer, 55 "tags": ["list of tags from the query"], 56 "values": ["known values from the query"], 57 "is_link_node": bool, // Does the node represent the link or the node (the oval shapes) 58 "is_fixed": bool // Is the node a fixed starting point of the query 59 }], 60 61 "links": [{ 62 "source": integer, // Node ID 63 "target": integer, // Node ID 64 "link_node": integer // Node ID 65 }] 66 } 67 ``` 68 69 #### `/api/v1/shape/gizmo` 70 71 POST Body: Javascript source code of the query 72 73 Response: JSON description of the last query executed. 74 75 #### `/api/v1/shape/mql` 76 77 POST Body: JSON MQL query 78 79 Response: JSON description of the query. 80 81 ### Write commands 82 83 Responses come in the form 84 85 200 Success: 86 87 ```javascript 88 { 89 "result": "Success message." 90 } 91 ``` 92 93 400 / 500 Error: 94 95 ```javascript 96 { 97 "error": "Error message." 98 } 99 ``` 100 101 #### `/api/v1/write` 102 103 POST Body: JSON quads 104 105 ```javascript 106 [{ 107 "subject": "Subject Node", 108 "predicate": "Predicate Node", 109 "object": "Object node", 110 "label": "Label node" // Optional 111 }] // More than one quad allowed. 112 ``` 113 114 Response: JSON response message 115 116 #### `/api/v1/write/file/nquad` 117 118 POST Body: Form-encoded body: 119 120 * Key: `NQuadFile`, Value: N-Quad file to write. 121 122 Response: JSON response message 123 124 Example: 125 126 ```text 127 curl http://localhost:64210/api/v1/write/file/nquad -F NQuadFile=@30k.n3 128 ``` 129 130 #### `/api/v1/delete` 131 132 POST Body: JSON quads 133 134 ```javascript 135 [{ 136 "subject": "Subject Node", 137 "predicate": "Predicate Node", 138 "object": "Object node", 139 "label": "Label node" // Optional 140 }] // More than one quad allowed. 141 ``` 142 143 Response: JSON response message. 144