Changeset View
Changeset View
Standalone View
Standalone View
docs/api.rst
Show First 20 Lines • Show All 169 Lines • ▼ Show 20 Lines | .. http:get:: /graph/randomwalk/:src/:dst | ||||
:param string src: starting node specified as a SWH PID | :param string src: starting node specified as a SWH PID | ||||
:param string dst: destination node, either as a node PID or a node type. | :param string dst: destination node, either as a node PID or a node type. | ||||
The traversal will stop at the first node encountered matching the | The traversal will stop at the first node encountered matching the | ||||
desired destination. | desired destination. | ||||
:query string edges: edges types the traversal can follow; default to | :query string edges: edges types the traversal can follow; default to | ||||
``"*"`` | ``"*"`` | ||||
:query string direction: direction in which graph edges will be followed; | :query string direction: direction in which graph edges will be followed; | ||||
can be either ``forward`` or ``backward``, default to ``forward`` | can be either ``forward`` or ``backward``, default to ``forward`` | ||||
:query int limit: limit the number of nodes returned. You can use positive | |||||
numbers to get the first N results, or negative numbers to get the last | |||||
zack: As this is a language-agnostic API, referring Python isn't very helpful here.
Can you rephrase… | |||||
N results starting from the tail; | |||||
default to ``0``, meaning no limit. | |||||
:statuscode 200: success | :statuscode 200: success | ||||
:statuscode 400: invalid query string provided | :statuscode 400: invalid query string provided | ||||
:statuscode 404: starting node cannot be found | :statuscode 404: starting node cannot be found | ||||
**Example:** | **Example:** | ||||
.. sourcecode:: http | .. sourcecode:: http | ||||
Show All 13 Lines | .. sourcecode:: http | ||||
swh:1:rev:b12563e00026b48b817fd3532fc3df2db2a0f460 | swh:1:rev:b12563e00026b48b817fd3532fc3df2db2a0f460 | ||||
swh:1:rev:13e8ebe80fb878bade776131e738d5772aa0ad1b | swh:1:rev:13e8ebe80fb878bade776131e738d5772aa0ad1b | ||||
swh:1:rev:cb39b849f167c70c1f86d4356f02d1285d49ee13 | swh:1:rev:cb39b849f167c70c1f86d4356f02d1285d49ee13 | ||||
... | ... | ||||
swh:1:rev:ff70949f336593d6c59b18e4989edf24d7f0f254 | swh:1:rev:ff70949f336593d6c59b18e4989edf24d7f0f254 | ||||
swh:1:snp:a511810642b7795e725033febdd82075064ed863 | swh:1:snp:a511810642b7795e725033febdd82075064ed863 | ||||
swh:1:ori:98aa0e71f5c789b12673717a97f6e9fa20aa1161 | swh:1:ori:98aa0e71f5c789b12673717a97f6e9fa20aa1161 | ||||
**Limit example:** | |||||
.. sourcecode:: http | |||||
GET /graph/randomwalk/swh:1:cnt:94a9ed024d3859793618152ea559a168bbcbb5e2/ori?direction=backward&limit=-2 HTTP/1.1 | |||||
Content-Type: text/plain | |||||
Transfer-Encoding: chunked | |||||
.. sourcecode:: http | |||||
HTTP/1.1 200 OK | |||||
swh:1:ori:98aa0e71f5c789b12673717a97f6e9fa20aa1161 | |||||
swh:1:snp:a511810642b7795e725033febdd82075064ed863 | |||||
Visit | Visit | ||||
----- | ----- | ||||
.. http:get:: /graph/visit/nodes/:src | .. http:get:: /graph/visit/nodes/:src | ||||
.. http:get:: /graph/visit/paths/:src | .. http:get:: /graph/visit/paths/:src | ||||
Performs a graph traversal and returns explored nodes or paths (in the order | Performs a graph traversal and returns explored nodes or paths (in the order | ||||
▲ Show 20 Lines • Show All 74 Lines • ▼ Show 20 Lines | .. http:get:: /graph/neighbors/count/:src | ||||
Return the amount of :http:get:`/graph/neighbors/:src` results | Return the amount of :http:get:`/graph/neighbors/:src` results | ||||
.. http:get:: /graph/visit/nodes/count/:src | .. http:get:: /graph/visit/nodes/count/:src | ||||
Return the amount of :http:get:`/graph/visit/nodes/:src` results | Return the amount of :http:get:`/graph/visit/nodes/:src` results | ||||
Returning last element only | |||||
--------------------------- | |||||
The following method variants, with trailing `/last` added, behave like their | |||||
already discussed counterparts but, instead of returning full results, return | |||||
the *last* element of the result that would have been returned: | |||||
.. | |||||
.. http:get:: /graph/walk/last/:src/:dst | |||||
Return the last among :http:get:`/graph/walk/:src/:dst` results | |||||
.. http:get:: /graph/randomwalk/last/:src/:dst | |||||
Return the last among :http:get:`/graph/randomwalk/:src/:dst` results | |||||
**Example** | |||||
.. sourcecode:: http | |||||
GET /graph/randomwalk/last/swh:1:cnt:94a9ed024d3859793618152ea559a168bbcbb5e2/ori?direction=backward HTTP/1.1 | |||||
Content-Type: text/plain | |||||
Transfer-Encoding: chunked | |||||
.. sourcecode:: http | |||||
HTTP/1.1 200 OK | |||||
swh:1:ori:39bdc50b7d7bc5b02a898148286adb1b816066ab | |||||
Stats | Stats | ||||
----- | ----- | ||||
.. http:get:: /graph/stats | .. http:get:: /graph/stats | ||||
Returns statistics on the compressed graph. | Returns statistics on the compressed graph. | ||||
:statuscode 200: success | :statuscode 200: success | ||||
Show All 35 Lines |
As this is a language-agnostic API, referring Python isn't very helpful here.
Can you rephrase this to say explicitly that positive numbers take the first N elements while negative ones the last N elements?
Other than that this looks good, thanks !