-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapi.http
69 lines (54 loc) · 1.6 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
@protocol = http://
# @hostname = qbank.techparkit.org
@hostname = 127.0.0.1:8000
@endpoint = api/user
@url = {{protocol}}{{hostname}}/{{endpoint}}
@createdAt = {{$timestamp}}
# @modifiedBy = {{$processEnv USERNAME}}
# #
#------------------ API TESTING ----------------#
# #
### get all data without pagination
### will return: { full_name: '', email: '', token: '' }
GET {{url}} HTTP/1.1
### get all data with pagination
GET {{url}}?page=1 HTTP/1.1
### search data with pagination
GET {{url}}?page=1&search=fat HTTP/1.1
### get one
# @prompt id enter id
GET {{url}}/{{id}} HTTP/1.1
### create data
# @prompt full_name enter full name
POST {{url}} HTTP/1.1
content-type: application/json
{
"full_name": "{{full_name}}",
"email": "{{full_name}}@gmail.com",
"dob": "{{$timestamp -7300 d}}",
"user_role": "admin",
"gender": "male",
"courses": "[\"webdesign\",\"graphics design\"]",
"description": "demo description",
"image": "avatar.png",
"createdAt": "{{createdAt}}"
}
### update data
# @prompt id enter id
# @prompt full_name enter full name
PUT {{url}}/{{id}} HTTP/1.1
content-type: application/json
{
"full_name": "{{full_name}}",
"email": "{{full_name}}@gmail.com",
"dob": "{{$timestamp - $randomInt 7300 7500}}",
"user_role": "admin",
"gender": "male",
"courses": "[\"webdesign\",\"graphics design\"]",
"description": "demo description",
"image": "avatar.png"
}
### delete data
# @prompt id enter id
DELETE {{url}}/{{id}} HTTP/1.1
content-type: application/json