Skip to content

Commit 3ffe29b

Browse files
committed
feature: moved reference section to separate doc
1 parent 75e1b4b commit 3ffe29b

1 file changed

Lines changed: 0 additions & 93 deletions

File tree

docs/04-more-examples.md

Lines changed: 0 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -25,99 +25,6 @@ Let’s first get you introduced to the (till now) only specification format sup
2525

2626
---
2727

28-
### Reference
29-
30-
Following yaml blocks can be used to identify different section of a Http specification file.
31-
32-
```yaml
33-
---
34-
request:
35-
# valid URL
36-
url: https://reqres.in/api/users/2
37-
38-
# for query string or url parameters
39-
url_params:
40-
one: 1
41-
two: true
42-
43-
# http method to use
44-
method: GET # or POST, PUT, PATCH, DELETE, OPTIONS, HEAD
45-
46-
# send requst headers
47-
# add any numbers of headers
48-
# Causion: some values or keys need to be wrapped with single (') or double (") quote
49-
headers:
50-
User-Agent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36'
51-
'Accept-Encoding': 'gzip, deflate'
52-
accept: '*/*'
53-
54-
# send authentication header.
55-
# two supported type: auth[bearer], auth[basic]:
56-
57-
# auth[bearer] example
58-
auth[bearer]:
59-
token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
60-
61-
# auth[basic] example
62-
auth[basic]:
63-
username: Some_USER
64-
password: 'Some-P@$$W03D'
65-
66-
# send request body with the request
67-
68-
# no body to send
69-
body[none]: ~
70-
71-
# to send application/x-www-form-urlencoded form enctype
72-
body[form]:
73-
'var 1': 'var str 1'
74-
var-2: 'var str 2'
75-
# note: this will just pass filepath as value
76-
var_3: file:///home/username/.vimrc
77-
78-
# to upload file as part of body use multipart/form-data like
79-
body[form-data]:
80-
'var 1': 'var str 1'
81-
var-2: 'var str 2'
82-
# note this will actually upload a file
83-
# we use file protocol (file://) scheme to identify a file
84-
var_3: file:///home/username/.vimrc
85-
var4: file:///home/username/Documents/CID-25601.IpPhone.rtf
86-
87-
# to send plain text
88-
body[text]: 'Plain text here'
89-
90-
# to pass as json to body pass a yaml object like
91-
body[json]: { user_id: 32, roll_no: 1, class: 2, name: 'Student name' }
92-
93-
# to pass a xml as body use a yaml literal block
94-
body[xml]: |
95-
<?xml version="1.0"?>
96-
<catalog>
97-
<book id="bk101">
98-
<author>Gambardella, Matthew</author>
99-
<title>XML Developer's Guide</title>
100-
<genre>Computer</genre>
101-
<price>44.95</price>
102-
<publish_date>2000-10-01</publish_date>
103-
<description>An in-depth look at creating applications
104-
with XML.</description>
105-
</book>
106-
<book id="bk102">
107-
<author>Ralls, Kim</author>
108-
<title>Midnight Rain</title>
109-
<genre>Fantasy</genre>
110-
<price>5.95</price>
111-
<publish_date>2000-12-16</publish_date>
112-
<description>A former architect battles corporate zombies,
113-
an evil sorceress, and her own childhood to become queen
114-
of the world.</description>
115-
</book>
116-
</catalog>
117-
```
118-
119-
---
120-
12128
### Examples
12229

12330
Following are the examples with HTTP GET method. Although all these example are still valid for POST, PUT, PATCH, DELETE, OPTIONS, HEAD method as well.

0 commit comments

Comments
 (0)