servant/servant-docs/example/greet.md

154 lines
2.6 KiB
Markdown
Raw Permalink Normal View History

## On proper introductions.
Hello there.
As documentation is usually written for humans, it's often useful to introduce concepts with a few words.
## This title is below the last
You'll also note that multiple intros are possible.
## POST /greet
2018-09-29 17:50:23 +02:00
### Request:
- Supported content types are:
2018-09-29 17:50:23 +02:00
- `application/json;charset=utf-8`
- `application/json`
2018-09-29 17:50:23 +02:00
- If you use ?capital=true (`application/json;charset=utf-8`, `application/json`):
```javascript
"HELLO, HASKELLER"
```
2018-09-29 17:50:23 +02:00
- If you use ?capital=false (`application/json;charset=utf-8`, `application/json`):
2018-09-29 17:50:23 +02:00
```javascript
"Hello, haskeller"
```
### Response:
- Status code 200
- Headers: [("X-Example","1729")]
- Supported content types are:
2018-09-29 17:50:23 +02:00
- `application/json;charset=utf-8`
- `application/json`
2018-09-29 17:50:23 +02:00
- If you use ?capital=true (`application/json;charset=utf-8`, `application/json`):
```javascript
"HELLO, HASKELLER"
```
2018-09-29 17:50:23 +02:00
- If you use ?capital=false (`application/json;charset=utf-8`, `application/json`):
```javascript
"Hello, haskeller"
```
### Sample Request:
```bash
curl -XPOST \
-H "Content-Type: application/json;charset=utf-8" \
-d "\"HELLO, HASKELLER\"" \
http://localhost:80/greet
```
## DELETE /greet/:greetid
2018-09-29 17:50:23 +02:00
### Title
This is some text
### Second section
And some more
2018-09-29 17:50:23 +02:00
### Captures:
- *greetid*: identifier of the greet msg to remove
2018-09-29 17:50:23 +02:00
### Headers:
- This endpoint is sensitive to the value of the **X-Num-Unicorns** HTTP header.
2018-09-29 17:50:23 +02:00
### Response:
- Status code 200
- Headers: []
- Supported content types are:
2018-09-29 17:50:23 +02:00
- `application/json;charset=utf-8`
- `application/json`
2018-09-29 17:50:23 +02:00
- Example (`application/json;charset=utf-8`, `application/json`):
```javascript
2018-09-29 17:50:23 +02:00
```
### Sample Request:
```bash
curl -XDELETE \
-H "X-Num-Unicorns: 1" \
http://localhost:80/greet/:greetid
```
## GET /hello/:name
2018-09-29 17:50:23 +02:00
### Captures:
- *name*: name of the person to greet
### Headers:
- This endpoint is sensitive to the value of the **X-Num-Fairies** HTTP header.
2018-09-29 17:50:23 +02:00
### GET Parameters:
- capital
- **Values**: *true, false*
- **Description**: Get the greeting message in uppercase (true) or not (false).Default is false.
2018-09-29 17:50:23 +02:00
### Response:
- Status code 200
- Headers: []
- Supported content types are:
2018-09-29 17:50:23 +02:00
- `application/json;charset=utf-8`
- `application/json`
- `text/plain;charset=utf-8`
2018-09-29 17:50:23 +02:00
- If you use ?capital=true (`application/json;charset=utf-8`, `application/json`, `text/plain;charset=utf-8`):
```javascript
"HELLO, HASKELLER"
```
2018-09-29 17:50:23 +02:00
- If you use ?capital=false (`application/json;charset=utf-8`, `application/json`):
```javascript
"Hello, haskeller"
```
### Sample Request:
```bash
curl -XGET \
-H "X-Num-Fairies: 1729" \
http://localhost:80/hello/:name
```