Skip to content

Commit

Permalink
Converted Link Walking to markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
ian-plosker committed Sep 29, 2011
1 parent ba15a28 commit 8361e9d
Showing 1 changed file with 40 additions and 17 deletions.
@@ -1,36 +1,59 @@
h1. HTTP Link Walking
Link walking (traversal) finds and returns objects by following links attached
to them, starting from the object specified by the bucket and key portion. It
is a special case of [[MapReduce]], and can be expressed more verbosely as such.
[[Read more about Links|Links]].

Link walking (traversal) finds and returns objects by following links attached to them, starting from the object specified by the bucket and key portion. It is a special case of [[MapReduce]], and can be expressed more verbosely as such. [[Read more about Links|Links]].

h2. Request
## Request

```bash
GET /riak/bucket/key/[bucket],[tag],[keep] # bucket,tag,keep is the link filter
```

<div class="info"><div class="title">Link filters</div>A link filter within the request URL is made of three parts, separated by commas:
<div class="info"><div class="title">Link filters</div>
<p>A link filter within the request URL is made of three parts, separated by
commas:</p>

* Bucket - a bucket name to limit the links to
* Tag - a "riaktag" to limit the links to
* Keep - 0 or 1, whether to return results from this phase
<ul>
<li>Bucket - a bucket name to limit the links to</li>
<li>Tag - a "riaktag" to limit the links to</li>
<li>Keep - 0 or 1, whether to return results from this phase</li>
</ul>

Any of the three parts may be replaced with @_@ (underscore), signifying that any value is valid. Multiple phases of links can be followed by adding additional path segments to the URL, separating the link filters by slashes. The final phase in the link-walking query implicitly returns its results.</div>
<p>Any of the three parts may be replaced with <code>_</code> (underscore),
signifying that any value is valid. Multiple phases of links can be followed by
adding additional path segments to the URL, separating the link filters by
slashes. The final phase in the link-walking query implicitly returns its
results.</p>
</div>

h2. Response
## Response

Normal status codes:
* @200 OK@

* `200 OK`

Typical error codes:
* @400 Bad Request@ - if the format of the query in the URL is invalid
* @404 Not Found@ - if the origin object of the walk was missing

Important headers:
* @Content-Type@ - always @multipart/mixed@, with a boundary specified
* `400 Bad Request` - if the format of the query in the URL is invalid
* `404 Not Found` - if the origin object of the walk was missing

<div class="note"><div class="title">Understanding the response body</div>The response body will always be @multipart/mixed@, with each chunk representing a single phase of the link-walking query. Each phase will also be encoded in @multipart/mixed@, with each chunk representing a single object that was found. If no objects were found or "keep" was not set on the phase, no chunks will be present in that phase. Objects inside phase results will include @Location@ headers that can be used to determine bucket and key. In fact, you can treat each object-chunk similarly to a complete response from [[fetching the object|HTTP Fetch Object]], without the status code.</div>
Important headers:

h2. Example
* `Content-Type` - always `multipart/mixed`, with a boundary specified

<div class="note"><div class="title">Understanding the response body</div>
<p>The response body will always be <code>multipart/mixed</code>, with each
chunk representing a single phase of the link-walking query. Each phase will
also be encoded in <code>multipart/mixed</code>, with each chunk representing a
single object that was found. If no objects were found or "keep" was not set on
the phase, no chunks will be present in that phase. Objects inside phase
results will include <code>Location</code> headers that can be used to determine
bucket and key. In fact, you can treat each object-chunk similarly to a complete
response from [[fetching the object|HTTP Fetch Object]], without the status
code.</p>
</div>

## Example

```bash
$ curl -v http://127.0.0.1:8098/riak/test/doc3/test,_,1/_,next,1
Expand Down

0 comments on commit 8361e9d

Please sign in to comment.