-
Notifications
You must be signed in to change notification settings - Fork 0
/
api.http
140 lines (104 loc) · 3.8 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
### Register
POST http://localhost:9999/auth/new
Accept: application/json
Content-Type: application/json
{
"email": "[email protected]",
"firstName": "David",
"lastName": "Kröll",
"password": "asdf1234"
}
### Get auth token
POST http://localhost:9999/auth
Accept: application/json
Content-Type: application/json
{
"email": "[email protected]",
"password": "asdf1234"
}
### Get auth token
### should fail
POST http://localhost:9999/auth
Accept: application/json
Content-Type: application/json
{
"email": "[email protected]",
"password": "wrong password"
}
### Get all shortcuts from authenticated user
GET http://localhost:9999/api/shortcuts
Accept: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJRCI6IjExIiwiZXhwIjoxNTU0Mzc2MzA4fQ.fvwF84sEIdqtWYuuXysGZXBQrKU2xn3UTUsxXYsLIds
### Get all shortcuts from unauthenticated user
### should fail
GET http://localhost:9999/api/shortcuts
Accept: application/json
### Get all shortcuts with invalid jwt
### should fail
GET http://localhost:9999/api/shortcuts
Accept: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJRCI6IjExIiwiZXU0Mzc2MzA4fQ.fvwF84sEIdqtWYuuXysGZXBQrKU2xn3UTUsxXYsLIds
### Get shortcut with given ID
GET http://localhost:9999/api/shortcuts/200
Accept: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJRCI6IjExIiwiZXhwIjoxNTU0Mzc2MzA4fQ.fvwF84sEIdqtWYuuXysGZXBQrKU2xn3UTUsxXYsLIds
### Get shortcut not belonging to user
### should fail
GET http://localhost:9999/api/shortcuts/7
Accept: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJRCI6IjAwMzY2ZmI5LWNkNzYtNDdlMC1iM2M2LWNiZDYxMTY1MGQ5ZSIsImV4cCI6MTU1Mjk4MDgxMn0.ZigpbO2X26HSlWAZ-XnWLJTy8eYArDo0i8CIZlPal5Y
### Create shortcut without authorization
### should fail
POST http://localhost:9999/api/shortcuts
Content-Type: application/json
Accept: application/json
{
"shortIdentifier": "htl2",
"redirectURL": "http://htl-villach.at",
"redirectStatus": 301,
"validThru": "2019-04-01T08:00:00.000+01:00"
}
### Create shortcut with authorization
POST http://localhost:9999/api/shortcuts
Content-Type: application/json
Accept: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJRCI6IjExIiwiZXhwIjoxNTU0Mzc2MzA4fQ.fvwF84sEIdqtWYuuXysGZXBQrKU2xn3UTUsxXYsLIds
{
"shortIdentifier": "htl-viladsfb",
"redirectURL": "http://htl-villach.at",
"redirectStatus": 301,
"validThru": "2019-04-01T08:00:00.000+01:00"
}
### Update shortcut
PUT http://localhost:9999/api/shortcuts/7
Content-Type: application/json
Accept: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJRCI6IjExIiwiZXhwIjoxNTU0Mzc2MzA4fQ.fvwF84sEIdqtWYuuXysGZXBQrKU2xn3UTUsxXYsLIds
{
"shortIdentifier": "h",
"redirectURL": "http://htl-villach.at",
"redirectStatus": 302,
"validThru": "2027-04-01T08:00:00.000+01:00"
}
### Update shortcut not belonging to user
### should fail
PUT http://localhost:9999/api/shortcuts/7
Content-Type: application/json
Accept: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJRCI6IjExIiwiZXhwIjoxNTU0Mzc2MzA4fQ.fvwF84sEIdqtWYuuXysGZXBQrKU2xn3UTUsxXYsLIds
{
"shortIdentifier": "htl34",
"redirectURL": "http://htl-villach.at",
"redirectStatus": 302,
"validThru": "2027-04-01T08:00:00.000+01:00"
}
### Delete shortcut not belonging to user
### should fial
DELETE http://localhost:9999/api/shortcuts/7
Accept: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJRCI6IjExIiwiZXhwIjoxNTU0Mzc2MzA4fQ.fvwF84sEIdqtWYuuXysGZXBQrKU2xn3UTUsxXYsLIds
### Delete shortcut
DELETE http://localhost:9999/api/shortcuts/200
Accept: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJRCI6IjExIiwiZXhwIjoxNTU0Mzc2MzA4fQ.fvwF84sEIdqtWYuuXysGZXBQrKU2xn3UTUsxXYsLIds
###