-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.http
More file actions
47 lines (36 loc) · 1.04 KB
/
example.http
File metadata and controls
47 lines (36 loc) · 1.04 KB
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
# REST Client Example File
# You can run requests with <leader>rr when cursor is on a request
### Get all users
GET https://jsonplaceholder.typicode.com/users
### Get single user
GET https://jsonplaceholder.typicode.com/users/1
### Create a new post
POST https://jsonplaceholder.typicode.com/posts
Content-Type: application/json
{
"title": "Test Post",
"body": "This is a test post from Neovim!",
"userId": 1
}
### Update a post
PUT https://jsonplaceholder.typicode.com/posts/1
Content-Type: application/json
{
"id": 1,
"title": "Updated Post",
"body": "This post has been updated",
"userId": 1
}
### Delete a post
DELETE https://jsonplaceholder.typicode.com/posts/1
### Using environment variables
# Create a .env file with:
# API_URL=https://api.example.com
# AUTH_TOKEN=your-token-here
# GET {{API_URL}}/users
# Authorization: Bearer {{AUTH_TOKEN}}
### GitHub API Example
GET https://api.github.com/users/github
Accept: application/vnd.github.v3+json
### Query parameters
GET https://jsonplaceholder.typicode.com/posts?userId=1&_limit=5