API
Briefkasten comes with a REST API reachable at https://briefkastenhq.com/api/**
. These are based on Next.js API Routes and the code can be found under /src/pages/api/**/*
.
Authentication
To authenticate to these routes, you must pass the user API Token as the Authorization
Header. For example:
js
const result = await axios.post(
'https://briefkastenhq.com/api/bookmarks',
{
url: 'https://reddit.com',
tags: 'web',
title: 'Reddit'
},
{
headers: {
Authorization: 'ABC123DEF456',
},
}
)
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
Routes
Below are the routes and HTTP methods which are available.
/api/bookmarks
GET
- SearchPOST
- CreatePUT
- UpdateDELETE
- Delete
/api/tags
GET
- SearchPOST
- CreatePUT
- UpdateDELETE
- Delete
/api/categories
GET
- SearchPOST
- CreatePUT
- UpdateDELETE
- Delete
Types
js
type Bookmark = {
id?: string
userId?: string
title: string
url: string
category?: string
desc?: string
tags?: string[]
}
type Tag = {
id?: string
userId?: string
name: string
emoji: string
}
type Category = {
id?: string
userId?: string
name: string
desc: string
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23