-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrequest.http
More file actions
106 lines (78 loc) · 2.27 KB
/
Copy pathrequest.http
File metadata and controls
106 lines (78 loc) · 2.27 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
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
# Restclient requests for examples/url-shortener/main.lisp
# Start the app first:
# sbcl --load examples/url-shortener/main.lisp
# restclient variable syntax
:base = http://localhost:3000
# Index
GET :base/
#
# Health
GET :base/health
#
# Create short URL (form-urlencoded)
POST :base/api/v1/links
Content-Type: application/x-www-form-urlencoded
url=https://example.com/docs/wst
#
# Create short URL (JSON)
POST :base/api/v1/links
Content-Type: application/json
{"url":"https://common-lisp.net"}
#
# List all short URLs
GET :base/api/v1/links
#
# Inspect one short URL by code
# Replace `1` with an existing code from the create response.
GET :base/api/v1/links/1
#
# Resolve short URL by code (redirect)
# Replace `1` with an existing code.
GET :base/1
#
# Delete one short URL by code
# Replace `1` with an existing code.
DELETE :base/api/v1/links/1
#
# Invalid create request (missing url)
POST :base/api/v1/links
Content-Type: application/json
{"target":"https://example.com"}
#
# Fallback any-route
GET :base/does-not-exist
# ------------------------------------------------------------
# Restclient requests for examples/bookmark-manager/main.lisp
# Start the app first in another shell:
# sbcl --load examples/bookmark-manager/main.lisp
#
# Reuse cookie jar support from your REST client to persist session cookies.
:bookmarks_base = http://localhost:3000
:session_id =
# Index
GET :bookmarks_base/
# Login (JSON)
POST :bookmarks_base/api/v1/session/login
Content-Type: application/json
{"user":"alice"}
# Create bookmark (requires session cookie)
POST :bookmarks_base/api/v1/bookmarks
Content-Type: application/x-www-form-urlencoded
Cookie: wst_session_id=:session_id
title=wst repo&url=https://github.com/cl-sdk/wst
# Create bookmark (JSON)
POST :bookmarks_base/api/v1/bookmarks
Content-Type: application/json
Cookie: wst_session_id=:session_id
{"title":"Common Lisp","url":"https://common-lisp.net"}
# List current user's bookmarks
GET :bookmarks_base/api/v1/bookmarks
Cookie: wst_session_id=:session_id
# Delete bookmark by id
# Replace `1` with an existing id from the list response.
DELETE :bookmarks_base/api/v1/bookmarks/6
Cookie: wst_session_id=:session_id
# Logout
POST :bookmarks_base/api/v1/session/logout
# Unauthorized after logout
GET :bookmarks_base/api/v1/bookmarks