-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapi.http
101 lines (85 loc) · 2.5 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
### Get array of all articles
# Article: {
# id:string,
# slug: string,
# title:string,
# url: string
# }
## Optional QueryStringParameters: {
## sortByDate = "ascending" | "descending"
## }
GET /articles
### Get article by id
# Article: {
# id: string,
# slug: string,
# title: string,
# meta_title: string,
# meta_description: string,
# blocks: {
# props: {
# blockMap: {
# [key:string]: NotionBlock
# }
# }
# },
# created_at: number,
# updated_at: number,
# file_id: string,
# url: string,
# notion_url: string
# }
GET /articles/:id
### Post new article
### All properties in request body required
POST /articles/create
>>>>>>> dev
Content-Type: application/json
# "notion_url" is notion article url
# "slug" should be lowercase latin word without
# "blocks" you can get from GET /notion-blocks
{
"title": "asdfdfd",
"meta_title": "qwevhgfxrty212458",
"meta_description": "metacsdvaqweqwrty322222",
"slug": "contentqweadfhsfbvsdfdnty311121",
"notion_url": "url",
"file_id": "d9bdbf96-b972-4692-a160-4c0fa9158a3c",
"blocks": "dsaasdasdasdasd"
}
### Change article by id
# Properties in body is optional, but at least one required
PUT /articles/:id
>>>>>>> dev
Content-Type: application/json
{
"title": "abcdsafsgfsdgdsefghigklmnop",
"meta_title": "qwerty228",
"meta_description": "metaqwerty322",
"notion_url": "contentqweadsfbdnty321"
}
### Refresh notion blocks by notion_url attached to the :id
POST /articles/refresh/:id
### Get pre-sign url for upload images with fields
### NOTE: If need rewrite image by existing key - set it in query params as fileId = key
# {
# "url": "https://s3.amazonaws.com/blog-api-dev-image-bucket", *** URL of POST request for uploading image
# "fields": { *** This fields generated by API and required in POST request form-data body
# "acl": string,
# "key": string, *** key === file_id => required for creating new article (check POST endpoint)
# "bucket": string,
# "X-Amz-Algorithm": string,
# "X-Amz-Credential": string,
# "X-Amz-Date": string,
# "X-Amz-Security-Token": string,
# "Policy": string,
# "X-Amz-Signature": string
# }
# }
GET /getPresignUrl
### For slug generation
# Query param "title" required
GET /transliterate
### Return notion md
# Query param "notion_url" required
GET /notion-blocks