mirror of
https://github.com/morten-olsen/http.md.git
synced 2026-02-08 00:46:28 +01:00
init
This commit is contained in:
14
docs/examples/getting-started.md
Normal file
14
docs/examples/getting-started.md
Normal file
@@ -0,0 +1,14 @@
|
||||
# My API Document
|
||||
|
||||
Let's make a POST request to httpbin.org.
|
||||
|
||||
```http
|
||||
POST https://httpbin.org/post
|
||||
Content-Type: application/json
|
||||
|
||||
{"greeting": "Hello, http.md!"}
|
||||
```
|
||||
|
||||
And here is the response:
|
||||
|
||||
::response
|
||||
22
docs/examples/with-multiple-requests.md
Normal file
22
docs/examples/with-multiple-requests.md
Normal file
@@ -0,0 +1,22 @@
|
||||
# Document with Multiple Requests
|
||||
|
||||
First, create a resource:
|
||||
|
||||
```http id=createUser
|
||||
POST https://httpbin.org/post
|
||||
Content-Type: application/json
|
||||
|
||||
{"username": "alpha"}
|
||||
```
|
||||
|
||||
Then, fetch a different resource:
|
||||
|
||||
```http id=getItem
|
||||
GET https://httpbin.org/get?item=123
|
||||
```
|
||||
|
||||
Response from creating the user:
|
||||
::response{#createUser}
|
||||
|
||||
Response from getting the item:
|
||||
::response{#getItem}
|
||||
16
docs/examples/with-template.md
Normal file
16
docs/examples/with-template.md
Normal file
@@ -0,0 +1,16 @@
|
||||
```http id=createItem json
|
||||
POST https://httpbin.org/post
|
||||
Content-Type: application/json
|
||||
|
||||
{"name": "My New Item"}
|
||||
```
|
||||
|
||||
The new item ID is: {{responses.createItem.body.json.name}}
|
||||
|
||||
Now, let's fetch the item using a (mocked) ID from the response:
|
||||
|
||||
```http id=fetchItem
|
||||
GET https://httpbin.org/anything/{{responses.createItem.body.json.name}}
|
||||
```
|
||||
|
||||
::response{#fetchItem}
|
||||
Reference in New Issue
Block a user