on master help sign in
update HTTP API reference for dist
8067063tinnus-napbus
content/docs/userspace/threads/http-api.md+5−5
@@ -9,10 +9,10 @@ Spider has an Eyre binding which allows threads to be run externally via [authen
9Spider is bound to the `/spider` URL path, and expects the requested URL to look like:
9Spider is bound to the `/spider` URL path, and expects the requested URL to look like:
10
10
11```
11```
12−http{s}://{host}/spider/{inputMark}/{threadName}/{outputMark}
12+http{s}://{host}/spider/{desk}/{inputMark}/{threadName}/{outputMark}
13```
13```
14
14
15−The `inputMark` is the `mark` the thread takes. The `threadName` is the name of the thread, e.g. `foo` for `/ted/foo/hoon`. The `outputMark` is the `mark` the thread produces. You may also include a file extension though it doesn't have an effect.
15+The `desk` is the desk in which the thread resides. The `inputMark` is the `mark` the thread takes. The `threadName` is the name of the thread, e.g. `foo` for `/ted/foo/hoon`. The `outputMark` is the `mark` the thread produces. You may also include a file extension though it doesn't have an effect.
16
16
17When Spider receives an HTTP request, the following steps happen:
17When Spider receives an HTTP request, the following steps happen:
18
18
@@ -30,7 +30,7 @@ Thus, it's important to understand that the original HTTP request and final HTTP
30
30
31Here we'll look at running Spider threads through Eyre.
31Here we'll look at running Spider threads through Eyre.
32
32
33−Here's an extremely simple thread that takes a `vase` of `(unit json)` and just returns the `json` in a new `vase`. You can save it in `/ted` and `|commit %home`:
33+Here's an extremely simple thread that takes a `vase` of `(unit json)` and just returns the `json` in a new `vase`. You can save it in `/ted` and `|commit %base`:
34
34
35`eyre-thread.hoon`
35`eyre-thread.hoon`
36
36
@@ -48,14 +48,14 @@ Here's an extremely simple thread that takes a `vase` of `(unit json)` and just
48
48
49First we must obtain a session cookie by [authenticating](/docs/arvo/eyre/examples#authenticating).
49First we must obtain a session cookie by [authenticating](/docs/arvo/eyre/examples#authenticating).
50
50
51−Now we can try and run our thread. Spider is bound to the `/spider` URL path, and expects the rest of the path to be `/{inputMark}/{thread}/{outputMark}`. Our `{thread}` is called `eyre-thread`, and both its `{inputMark}` and `{outputMark}` are `json`, so our URL path will be `/spider/json/eyre-agent/json`. Our request will be an HTTP POST request and the body will be some `json`, in this case `[{"foo": "bar"}]`:
51+Now we can try and run our thread. Spider is bound to the `/spider` URL path, and expects the rest of the path to be `/{desk}/{inputMark}/{thread}/{outputMark}`. Our `{thread}` is called `eyre-thread` and is in the `%base` `{desk}`. Both its `{inputMark}` and `{outputMark}` are `json`. Therefore, our URL path will be `/spider/base/json/eyre-agent/json`. Our request will be an HTTP POST request and the body will be some `json`, in this case `[{"foo": "bar"}]`:
52
52
53```
53```
54curl -i --header "Content-Type: application/json" \
54curl -i --header "Content-Type: application/json" \
55 --cookie "urbauth-~zod=0v6.h6t4q.2tkui.oeaqu.nihh9.i0qv6" \
55 --cookie "urbauth-~zod=0v6.h6t4q.2tkui.oeaqu.nihh9.i0qv6" \
56 --request POST \
56 --request POST \
57 --data '[{"foo": "bar"}]' \
57 --data '[{"foo": "bar"}]' \
58− http://localhost:8080/spider/json/eyre-thread/json
58+ http://localhost:8080/spider/base/json/eyre-thread/json
59```
59```
60
60
61Spider will run the thread and the result will be returned through Eyre in the body of an HTTP response with a 200 status code:
61Spider will run the thread and the result will be returned through Eyre in the body of an HTTP response with a 200 status code: