Endpoint: auth/token/
Sample request
Body:
"username": "<username>"
"password": "<password>"
Sample response
{
"refresh":"<refresh token>",
"access":"<access token>",
"is_staff":false,
"first_name":"<first name>",
"last_name":"<last name>",
"user_id":"user id"
}
Sample request
Body:
"refresh": "<refresh code>"
Sample response
{"access":"<access token>"}
Endpoint: /api/user/
Fields
| Field | Create | Update |
|---|---|---|
| user_id | NO CHANGE | NO CHANGE |
| profile_pic | Optional | Optional |
| username | Required | NO CHANGE |
| password | Required | Optional |
| Required | Optional | |
| first_name | Optional | Optional |
| last_name | Optional | Optional |
| is_staff | Admin - Optional | Admin - Optional |
| is_superuser | Admin - Optional | Admin - Optional |
| is_active | Admin - Optional | Admin - Optional |
| date_joined | NO CHANGE | NO CHANGE |
| groups | Admin - Optional | Admin - Optional |
| user_permissions | Not used | Not used |
- Create user
- Endpoint: /api/user/
- Request method: POST
- List users
- Endpoint: /api/user/
- Request method: GET
- Retrieve user
- Endpoint: /api/user/
- Request method: GET
- Update user
- Endpoint: /api/user/
- Request method: PUT
- Delete user
- Endpoint: /api/user/
- Request method: DELETE
Endpoint: /api/group/
Fields
| Field | Create | Update | |
|---|---|---|---|
| id | NO CHANGE | NO CHANGE | |
| name | Admin - required | Admin - required | UNIQUE |
- Create group
- Endpoint: /api/group/
- Request method: POST
- List groups
- Endpoint: /api/group/
- Request method: GET
- Retrieve group
- Endpoint: /api/group/
- Request method: GET
- Update group
- Endpoint: /api/group/
- Request method: PUT
- Delete group
- Endpoint: /api/group/
- Request method: DELETE
Endpoint: /api/post/
Fields
| Field | Create | Update |
|---|---|---|
| id | NO CHANGE | NO CHANGE |
| title | Required | Required |
| description | Optional | Optional |
| body | Optional | Optional |
| video | Optional | Optional |
| audio | Optional | Optional |
| view | NO CHANGE | NO CHANGE |
| is_public | Optional Auto false | Optional |
| like | NO CHANGE | NO CHANGE |
| createdTimestamp | NO CHANGE | NO CHANGE |
| lastUpdatedTimestamp | NO CHANGE | NO CHANGE |
| owner | NO CHANGE | NO CHANGE |
| category | Optional | Optional |
- Create post
- Endpoint: /api/post/
- Request method: POST
- List posts
- Endpoint: /api/post/
- Request method: GET
- Retrieve post
- Endpoint: /api/post/
- Request method: GET
- Update post
- Endpoint: /api/post/
- Request method: PUT
- Delete post
- Endpoint: /api/post/
- Request method: DELETE
- Parameters
- author=<user_id> - contains
- title=<title> - contains
- category=<category_name> - match exactly
- order_by=
Endpoint: /api/category/
Fields
| Field | Create | Update | |
|---|---|---|---|
| name | Admin - required | Admin - required | UNIQUE |
| created-by | NO CHANGE | NO CHANGE |
- Create category
- Endpoint: /api/category/
- Request method: POST
- List categories
- Endpoint: /api/category/
- Request method: GET
- Retrieve category
- Endpoint: /api/category/
- Request method: GET
- Update category
- Endpoint: /api/category/
- Request method: PUT
- Delete category
- Endpoint: /api/category/
- Request method: DELETE
- Parameters
- parent= - get child categories by parent
- parent=root - only root parents
端点: /api/blog_visit_log/
When access a blog that does not belong to user self, /api/post/ would return field <blog_visit_log>,which is the log id。 Use this id to update the log time.
- List view history
- Endpoint: /api/blog_visit_log/
- Request method: GET
- Default returns all logged in user's view history。
- Admin returns all view history。
- Update view history
- Endpoint: /api/blog_visit_log/<blog_visit_log>
- Request method: PUT
- No need to provide any data, backend will update the last signal time.
- Parameters
- post=
- Admin:Get all view history for this post.
- Others:If the post belongs to user self, return all history for this post. if not, return nothing.
- user=<用户ID>
- Admin:Get all view history of this user.
- Others:If user is self, return user's all view history. if not, return nothing.
- post=