This repository has been archived by the owner on Jan 17, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrest.http
78 lines (61 loc) · 1.48 KB
/
rest.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
# -*- restclient -*-
#
# This file contains example requests.
# It can be used directly with Emacs restclient plugin.
# See https://github.com/pashky/restclient.el
#
:username = "user2"
:password = "pass2"
:host = 127.0.0.1:5000
:url = http://:host/api/v1
# Get auth token
POST :url/login
Content-Type: application/json
{
"username": :username,
"password": :password
}
# Put token ↓↓↓ (use request above)
:token = ???
# Get all saved bookmarks (unauthorized)
GET :url/bookmarks
# Get all saved bookmarks (authorized)
GET :url/bookmarks
Authorization: JWT :token
# Get all saved bookmarks (bad token)
GET :url/bookmarks
Authorization: JWT 42
# Save bookmark
POST :url/bookmarks
Authorization: JWT :token
Content-Type: application/json
{
"url": "http://github.com/heutagogy/heutagogy-backend",
"title": "heutagogy/heutagogy-backend",
"timestamp": "2016-11-19T01:31:15"
}
# Save bookmark (no timestamp)
# This will use current UTC time
POST :url/bookmarks
Authorization: JWT :token
Content-Type: application/json
{
"url": "http://github.com/heutagogy/heutagogy-backend",
"title": "heutagogy-backend"
}
# Save bookmark (no title)
# This will use url as a title
POST :url/bookmarks
Authorization: JWT :token
Content-Type: application/json
{
"url": "https://github.com/heutagogy"
}
# Delete bookmark
# Put ↓↓↓ article id to delete
:id= ???
DELETE :url/bookmarks/:id
Authorization: JWT :token
# Get by url
GET :url/bookmarks?url=https%3A%2F%2Fgithub.com
Authorization: JWT :token