-
Notifications
You must be signed in to change notification settings - Fork 0
/
api.http
107 lines (82 loc) · 2.59 KB
/
api.http
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
### REST Client for Visual Studio Code
@BASE_URI=http://localhost:3000
@ACCESS_TOKEN=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOjEsImlhdCI6MTU2NzgyNDI0MiwiZXhwIjoxNTcwNDE2MjQyfQ.mBwmR7Rntwobz9s1MoBqGLAOrXJaSdi3qkFcce82Sh4
@username=adminNew
@ACCESS_TOKEN2=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOjQsImlhdCI6MTU2NzgyOTIxNCwiZXhwIjoxNTcwNDIxMjE0fQ.Pze_KDXYG35X_GCK4squhCsy4X-m5jAFiJxGkB-3tN0
@username2=adminNew1
@password=666666
@articleSlug=this-is-firs-article-zmjtpr
### login
POST {{BASE_URI}}/users/login HTTP/1.1
Content-Type: application/json
{
"username": "{{email}}",
"password": "{{password}}"
}
### register
POST {{BASE_URI}}/users http/1.1
Content-Type: application/json
{
"username": "{{username}}1",
"password": "{{password}}",
"email": "1{{email}}"
}
### get status
GET {{BASE_URI}}/user http/1.1
Authorization: Token {{ACCESS_TOKEN2}}
### update user
PUT {{BASE_URI}}/user http/1.1
Content-Type: application/json
Authorization: Token eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiaWF0IjoxNTY3MDU5NDQyLCJleHAiOjE1NjcwNTk1MDJ9.5qK5u__0q9T_RTXHXMM3lVsDvpQq8NNxWTW3VwnU07w
{
"bio": "biobiokjhkdre",
"image": "image222.png"
}
### get profile
GET {{BASE_URI}}/profiles/{{username}} http/1.1
Authorization: Token {{ACCESS_TOKEN}}
### follow
POST {{BASE_URI}}/profiles/{{username}}/follow http/1.1
Authorization: Token {{ACCESS_TOKEN2}}
### test
GET {{BASE_URI}} http/1.1
### create article
POST {{BASE_URI}}/articles http/1.1
Authorization: Token {{ACCESS_TOKEN2}}
Content-Type: application/json
{
"title": "Awesome article",
"description": "DEsc",
"body": "I am body",
"tagList": ["dsf", "343", "dfie"]
}
### get by slug
GET {{BASE_URI}}/articles/{{articleSlug}} http/1.1
### favorite
POST {{BASE_URI}}/articles/{{articleSlug}}/favorite http/1.1
Authorization: Token {{ACCESS_TOKEN}}
### create comment
POST {{BASE_URI}}/articles/{{articleSlug}}/comments
Authorization: Token {{ACCESS_TOKEN2}}
Content-Type: application/json
{
"comment": {
"body": "A comment22"
}
}
### get comment
GET {{BASE_URI}}/articles/{{articleSlug}}/comments
Authorization: Token {{ACCESS_TOKEN}}
### delete comment
DELETE {{BASE_URI}}/articles/{{articleSlug}}/comments/1
Authorization: Token {{ACCESS_TOKEN}}
### get article
# GET {{BASE_URI}}/articles?author=adminNew&tag=dsf&favorited=adminNew&limit=10&offset=0
# GET {{BASE_URI}}/articles?tag=343
GET {{BASE_URI}}/articles?favorited=adminNew
# GET {{BASE_URI}}/articles
Authorization: Token {{ACCESS_TOKEN2}}
### article feed
GET {{BASE_URI}}/articles/feed?limit=3&offset=4
Authorization: Token {{ACCESS_TOKEN2}}