- Account Management Endpoints
1.1 User Signup
Method: POST
Endpoint: /account/signup
Description: Registers a new user account.
Request Parameters (x-www-form-urlencoded)
| Parameter | Type | Required | Description |
|---|---|---|---|
| userId | string | Yes | Username, 5-16 non-empty characters |
| secret | string | Yes | Password, 5-16 non-empty characters |
userId=cloudDev99&secret=securePass
Response (application/json)
| Field | Type | Required | Description |
|---|---|---|---|
| status | number | Yes | Status code: 0 success, 1 failure |
| info | string | No | Feedback message |
| payload | object | No | Response data |
{
"status": 0,
"info": "Registration successful",
"payload": null
}
1.2 User Authentication
Method: POST
Endpoint: /account/auth
Description: Authenticates user credentials.
Request Parameters (x-www-form-urlencoded)
| Parameter | Type | Required | Description |
|---|---|---|---|
| userId | string | Yes | Username, 5-16 non-empty characters |
| secret | string | Yes | Password, 5-16 non-empty characters |
userId=cloudDev99&secret=securePass
Response (application/json)
| Field | Type | Required | Description |
|---|---|---|---|
| status | number | Yes | Status code: 0 success, 1 failure |
| info | string | No | Feedback message |
| payload | string | Yes | JWT Token |
{
"status": 0,
"info": "Login successful",
"payload": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjbGFpbXMiOnsiaWQiOjUsInVzZXJuYW1lIjoid2FuZ2JhIn0sImV4cCI6MTY5MzcxNTk3OH0.pE_RATcoF7Nm9KEp9eC3CzcBbKWAFOL0IsuMNjnZ95M"
}
Authentication Note
Upon successful login, a JWT token is issued. For subsequent requests, include this token in the HTTP Header named Authorization. If the user is not authenticated, the server returns HTTP status 401.
1.3 Fetch Profile Details
Method: GET
Endpoint: /account/profile
Description: Retrieves details of the currently authenticated user.
Response (application/json)
| Field | Type | Required | Description |
|---|---|---|---|
| status | number | Yes | Status code |
| info | string | No | Feedback message |
| payload | object | Yes | Profile object |
| |- id | number | No | Primary Key |
| |- userId | string | No | Username |
| |- displayName | string | No | Nickname |
| string | No | Email address | |
| |- avatar | string | No | Avatar URL |
| |- joined | string | No | Creation timestamp |
| |- modified | string | No | Last update timestamp |
{
"status": 0,
"info": "Profile fetched",
"payload": {
"id": 5,
"userId": "mengshujun",
"displayName": "",
"mail": "",
"avatar": "",
"joined": "2023-09-02 22:21:31",
"modified": "2023-09-02 22:21:31"
}
}
1.4 Modify Profile Info
Method: PUT
Endpoint: /account/modify
Description: Updates user profile info (excluding avatar and password).
Request Parameters (application/json)
| Parameter | Type | Required | Description |
|---|---|---|---|
| id | number | Yes | Primary Key |
| userId | string | No | Username, 5-16 chars |
| displayName | string | Yes | Nickname, 1-10 chars |
| string | Yes | Valid email format |
{
"id": 5,
"userId": "mengshujun",
"displayName": "yg",
"mail": "877218421@qq.cn"
}
Response
{
"status": 0,
"info": "Update successful",
"payload": null
}
1.5 Change Avatar
Method: PATCH
Endpoint: /account/avatar
Description: Updates the user's profile picture.
Request Parameters (queryString)
| Parameter | Type | Required | Description |
|---|---|---|---|
| imgUrl | string | Yes | URL of the avatar image |
imgUrl=https://cloud-notes-gwd.oss-cn-beijing.aliyuncs.com/9bf1cf5b-1420-4c1b-91ad-e0f4631cbed4.png
Response
{
"status": 0,
"info": "Avatar updated",
"payload": null
}
1.6 Reset Password
Method: PATCH
Endpoint: /account/password
Description: Resets the user's account password.
Request Parameters (application/json)
| Parameter | Type | Required | Description |
|---|---|---|---|
| current | string | Yes | Current password |
| fresh | string | Yes | New password |
| confirm | string | Yes | Confirm new password |
{
"current": "123456",
"fresh": "234567",
"confirm": "234567"
}
Response
{
"status": 0,
"info": "Password changed",
"payload": null
}
- Category Management
2.1 Create Category
Method: POST
Endpoint: /sections
Description: Adds a new article category.
Request Parameters (application/json)
| Parameter | Type | Required | Description |
|---|---|---|---|
| label | string | Yes | Category Name |
| slug | string | Yes | Category Alias |
{
"label": "Humanities",
"slug": "rw"
}
Response
{
"status": 0,
"info": "Category created",
"payload": null
}
2.2 List Categories
Method: GET
Endpoint: /sections
Description: Retrieves all categories for the logged-in user.
Response (application/json)
| Field | Type | Required | Description |
|---|---|---|---|
| status | number | Yes | Status code |
| info | string | No | Feedback message |
| payload | array | Yes | List of categories |
| |- id | number | No | Primary Key |
| |- label | string | No | Category Name |
| |- slug | string | No | Category Alias |
| |- joined | string | No | Created time |
| |- modified | string | No | Updated time |
{
"status": 0,
"info": "Fetch successful",
"payload": [
{"id": 3, "label": "Food", "slug": "my", "joined": "2023-09-02 12:06:59", "modified": "2023-09-02 12:06:59"},
{"id": 4, "label": "Entertainment", "slug": "yl", "joined": "2023-09-02 12:08:16", "modified": "2023-09-02 12:08:16"}
]
}
2.3 Get Category Details
Method: GET
Endpoint: /sections/detail
Description: Fetches a specific category by ID.
Request Parameters (queryString)
| Parameter | Type | Required | Description |
|---|---|---|---|
| id | number | Yes | Primary Key |
id=6
Response
{
"status": 0,
"info": "Details fetched",
"payload": {
"id": 6,
"label": "Local Customs",
"slug": "ftrq",
"joined": "2023-09-03 11:07:13",
"modified": "2023-09-03 11:13:39"
}
}
2.4 Update Category
Method: PUT
Endpoint: /sections
Description: Modifies an existing category.
Request Parameters (application/json)
{
"id": 6,
"label": "Local Customs",
"slug": "ftrq"
}
Response
{
"status": 0,
"info": "Update successful",
"payload": null
}
2.5 Remove Category
Method: DELETE
Endpoint: /sections
Description: Deletes a category by ID.
Request Parameters (queryString)
id=6
Response
{
"status": 0,
"info": "Deletion successful",
"payload": null
}
- Article Management
3.1 Publish Article
Method: POST
Endpoint: /posts
Description: Creates a new article.
Request Parameters (application/json)
| Parameter | Type | Required | Description |
|---|---|---|---|
| heading | string | Yes | Title, 1-10 chars |
| body | string | Yes | Article content |
| thumbnail | string | Yes | Cover image URL |
| status | string | Yes | Published | Draft |
| sectionId | number | Yes | Category ID |
{
"heading": "Shaanxi Travel Guide",
"body": "Terracotta Army, Huaqing Pool, Famen Temple, Huashan",
"thumbnail": "https://cloud-notes-gwd.oss-cn-beijing.aliyuncs.com/9bf1cf5b-1420-4c1b-91ad-e0f4631cbed4.png",
"status": "Draft",
"sectionId": 2
}
Response
{
"status": 0,
"info": "Article published",
"payload": null
}
3.2 Search Articles (Paginated)
Method: GET
Endpoint: /posts
Description: Searches articles with filters and pagination.
Request Parameters (queryString)
| Parameter | Type | Required | Description |
|---|---|---|---|
| page | number | Yes | Page number |
| limit | number | Yes | Items per page |
| sectionId | number | No | Category ID |
| status | string | No | Published | Draft |
page=1&limit=3§ionId=2&status=Draft
Resposne
{
"status": 0,
"info": "Search successful",
"payload": {
"total": 1,
"items": [
{
"id": 5,
"heading": "Shaanxi Travel Guide",
"body": "Terracotta Army, Huaqing Pool, Famen Temple, Huashan",
"thumbnail": "https://cloud-notes-gwd.oss-cn-beijing.aliyuncs.com/9bf1cf5b-1420-4c1b-91ad-e0f4631cbed4.png",
"status": "Draft",
"sectionId": 2,
"joined": "2023-09-03 11:55:30",
"modified": "2023-09-03 11:55:30"
}
]
}
}
3.3 Get Article Detail
Method: GET
Endpoint: /posts/detail
Description: Retrieves a specific article by ID.
Request Parameters (queryString)
id=4
Response
{
"status": 0,
"info": "Fetch successful",
"payload": {
"id": 4,
"heading": "Beijing Travel Guide",
"body": "Tiananmen, Summer Palace, Bird's Nest, Great Wall",
"thumbnail": "https://cloud-notes-gwd.oss-cn-beijing.aliyuncs.com/9bf1cf5b-1420-4c1b-91ad-e0f4631cbed4.png",
"status": "Published",
"sectionId": 2,
"joined": "2023-09-03 11:35:04",
"modified": "2023-09-03 11:40:31"
}
}
3.4 Edit Article
Method: PUT
Endpoint: /posts
Description: Updates an existing article.
Request Parameters (application/json)
{
"id": 4,
"heading": "Beijing Travel Guide",
"body": "Tiananmen, Summer Palace, Bird's Nest, Great Wall",
"thumbnail": "https://cloud-notes-gwd.oss-cn-beijing.aliyuncs.com/9bf1cf5b-1420-4c1b-91ad-e0f4631cbed4.png",
"status": "Published",
"sectionId": 2
}
Response
{
"status": 0,
"info": "Update successful",
"payload": null
}
3.5 Delete Article
Method: DELETE
Endpoint: /posts
Description: Removes an article by ID.
Request Parameters (queryString)
id=4
Response
{
"status": 0,
"info": "Deletion successful",
"payload": null
}
- Utility Endpoints
4.1 File Upload
Method: POST
Endpoint: /upload
Description: Uploads a single file to the server.
Request Parameters (multipart/form-data)
| Parameter | Type | Required | Description |
|---|---|---|---|
| file | file | Yes | The file to upload |
Response (application/json)
| Field | Type | Required | Description |
|---|---|---|---|
| status | number | Yes | Status code |
| info | string | No | Feedback message |
| payload | string | Yes | Aliyun OSS storage URL |
{
"status": 0,
"info": "Upload successful",
"payload": "https://cloud-notes-gwd.oss-cn-beijing.aliyuncs.com/b5811871-acc8-4583-8399-cf0dc73591ab.png"
}