-
Notifications
You must be signed in to change notification settings - Fork 16
/
example-httpbin.apib
126 lines (101 loc) · 2.84 KB
/
example-httpbin.apib
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
--- Examples against httpbin.org ---
---
Examples of how some requests to _httpbin.org_ can be specified. Read more about
the httpbin.org API at https://httpbin.org/.
See ../README.md for details on how to test this specification.
---
# First request and response
Get a teapot from some full URL.
Leading or trailing blank lines in the body are stripped, unless you delimit
the body lines with the markers <<< (start) and >>> (end). The newlines after
<<< as well as the newline before >>> is not included in the body.
GET /status/418
> Accept: *
> User-Agent: KATT
> Host: {{<hostname}}:{{<port}}
< 418
< X-More-Info: {{_}}://tools.ietf.org/html/rfc2324
<<<
-=[ teapot ]=-
_...._
.' _ _ `.
| ."` ^ `". _,
\_;`"---"`|//
| ;/
\_ _/
`"""`
>>>
# Second request and response
Get unauthorized.
Also note that we don't expect any body.
The current date will be available to use in later requests as `{{<some_date}}.`
GET /status/401
> Accept: *
> User-Agent: KATT
< 401
< Www-Authenticate: Basic realm="Fake Realm"
< Date: {{>some_date}}
# Third request
Note that the title of this operation is "Third request", but that's just
markdown for you. You don't need to include a title, or even a description of
the operations unless you want to. In the fourth request we will skip the
description altogether.
Here we are getting a cached response.
GET /cache
> Accept: application/json
> User-Agent: KATT
< 200
< Content-Type: application/json
{
"url": "{{<protocol}}//{{<hostname}}/cache",
"headers": {
"Host": "{{<hostname}}"
},
"args": "{{_}}",
"origin": "{{_}}"
}
GET /cache
> Accept: application/json
> User-Agent: KATT
> If-Modified-Since: {{<some_date}}
< 304
A fifth request to show that whitespace in JSON body is insignificant.
POST /post
> Accept: application/json
> Content-Type: application/json
> User-Agent: KATT
{"hostname":"{{<hostname}}","whoarewe":"{{<your_name}}_and_{{<my_name}}","date":"{{<some_date}}"}
< 200
< Content-Type: application/json
{
"args": "{{_}}",
"data": "{{>raw_data}}",
"files": {},
"form": {},
"headers": {
"Host": "{{<hostname}}"
},
"origin": "{{_}}",
"url": "{{<protocol}}//{{<hostname}}/post",
"json": {
"hostname": "{{<hostname}}",
"date": "{{<some_date}}",
"whoarewe": "{{>whoarewe}}"
}
}
PARAM some_static_param="somevalue"
GET /get?whoarewe={{<whoarewe}}&hostname={{<hostname}}&somevalue={{<some_static_param}}
> Accept: application/json
> User-Agent: KATT
< 200
< Content-Type: application/json
{
"args": {
"whoarewe": "{{<your_name}}_and_{{<my_name}}",
"hostname": "{{<hostname}}{{_}}",
"somevalue": "{{<some_static_param}}"
},
"headers": "{{_}}",
"origin": "{{_}}",
"url": "{{<protocol}}//{{<hostname}}/get?{{_}}&hostname={{<hostname}}&{{_}}"
}