zrr
zrr
@zrr

开源地址

抱歉,此处内容请回复后刷新页面查看

锦词接口文档API




TOKEN说明

md5(秘钥|time.time())|time.time()

例子

import requests
import time
import hashlib

ctime = time.time()

key = '秘钥'
new_key = "%s|%s" % (key, ctime)

m = hashlib.md5()
m.update(bytes(new_key, encoding='utf-8'))
md5_key = m.hexdigest()
md5_key_key = "%s|%s" % (md5_key, ctime)
response = requests.get('API', headers={'auth-api': md5_key_key})

全局CODE

statusCode描述
404404您访问的内容不存在或被删除
400400参数格式不正确
405405表单请求方式错误
401401请登录
500500服务器正忙,请稍后重试

用户类API

用户注册API

  • 请求URL(POST)
/v1/users/user/api/register
  • 请求参数
参数值类型描述
email必填邮箱
password必填密码
nickname必填昵称
  • 返回状态码Status=201

用户登录API

  • 请求URL(POST)
/v1/users/user/api/login
  • 请求参数
参数值类型描述
username必填邮箱
password必填密码
  • 返回状态码Status=201

用户操作API(需要登录)

  • 请求URL(PUT,GET,DELETE,PATCH)
/v1/users/user/api/handle
  1. PUT请求(用户登出)
  • 返回状态码Status=200
  1. GET请求(用户详细信息读取包括登录日志)
参数值类型描述
limit选填登录日志条数(默认3)
  • 返回实例(Status=201)

{
    "user": {
        "uid": 1,
        "email": "2501070055@qq.com",
        "nickname": "ZRR",
        "last_login": "2021-08-14T01:20:50.924Z",
        "date_joined": "2021-08-04T13:21:43.032Z"
    },
    "user_info": {
        "username": "你好啊",
        "avatar": "http://localhost:8000/medias/avatar/20210807/20210807_103624.png",
        "email": "2501070055@qq.com",
        "signature": "个性",
        "sex": 1,
        "age": 10,
        "status": "隐身"
    },
    "user_login_records": {
        "user_login_records": [
            {
                "id": 32,
                "user_id": 1,
                "username": "你好啊",
                "ip": "127.0.0.1",
                "address": null,
                "source": "",
                "version": "",
                "created_at": "2021-08-14 01:20:50"
            },
            {
                "id": 31,
                "user_id": 1,
                "username": "你好啊",
                "ip": "127.0.0.1",
                "address": null,
                "source": "",
                "version": "",
                "created_at": "2021-08-13 15:46:27"
            },
            {
                "id": 26,
                "user_id": 1,
                "username": "你好啊",
                "ip": "127.0.0.1",
                "address": null,
                "source": "",
                "version": "",
                "created_at": "2021-08-13 12:13:58"
            }
        ]
    }
}

  1. DELETE请求(用户注销)
  • 请求参数
参数值类型描述
is_active选填填0
  • 返回状态码Status=200
  1. PATCH请求(用户在线状态)
  • 请求参数
参数值类型描述
status选填0表示在线,1表示隐身,默认0
  • 返回状态码Status=200

用户详细信息更改API(需要登录)

  • 请求URL(POST)
/v1/users/user/api/detail
  • 请求参数
参数值类型描述
age选填年龄
sex选填性别,1为男,0为女,默认1
avatar选填头像(上传图片)
signature选填个性签名
username选填用户名
  • 返回状态码Status=201

用户关注与取消关注API(需要登录)

  • 请求URL
/v1/users/user/api/follow/<int:pk>
  • pk=uid
  • 关注返回Status=201,取消关注返回Status=200

用户关注列表API

  • 请求URL(GET)
/v1/users/user/api/attentionlist/<int:pk>
  • pk=uid
  • 返回实例(Status=200)

{
    "user": [
        {
            "id": 1,
            "user_id": 7,
            "follow_id": 1,
            "status": 1,
            "follow_time": "2021-08-07 03:37:14"
        },
        {
            "id": 24,
            "user_id": 9,
            "follow_id": 1,
            "status": 1,
            "follow_time": "2021-08-14 03:13:59"
        },
        {
            "id": 25,
            "user_id": 10,
            "follow_id": 1,
            "status": 1,
            "follow_time": "2021-08-14 03:15:16"
        }
    ]
}{
    "user_follow": [
        {
            "id": 1,
            "user_id": 7,
            "follow_id": 1,
            "status": 1,
            "follow_time": "2021-08-07 03:37:14"
        },
        {
            "id": 24,
            "user_id": 9,
            "follow_id": 1,
            "status": 1,
            "follow_time": "2021-08-14 03:13:59"
        },
        {
            "id": 25,
            "user_id": 10,
            "follow_id": 1,
            "status": 1,
            "follow_time": "2021-08-14 03:15:16"
        }
    ]
}


粉丝列表API

  • 请求URL(GET)
/v1/users/user/api/fanslist/<int:pk>
  • pk=uid
  • 返回实例(Status=200)

{
    "user": [
        {
            "id": 1,
            "user_id": 7,
            "follow_id": 1,
            "status": 1,
            "follow_time": "2021-08-07 03:37:14"
        }
    ]
}


获取用户详细信息API

  • 请求URL(GET)
/v1/users/user/api/userdetail/<int:pk>
  • pk=uid
  • 返回实例(Status=200)

{
    "user": {
        "nickname": "ZRR",
        "last_login": "2021-08-14T02:19:08.541Z",
        "avatar": "http://localhost:8000/medias/avatar/20210814/79265620210814_104330.png",
        "signature": "",
        "sex": 1,
        "age": 18
    }
}


板块主题类API

获取板块类API

  • 请求URL(GET)
/v1/plates/plate/api/plate/list
  • 返回实例(Status=200)

{
    "plates": [
        {
            "id": 1,
            "plate_title": "热门",
            "plate_dp": null,
            "created_at": "2021-08-07 14:20:35",
            "updated_at": "2021-08-07 14:20:37",
            "status": 1
        },
        {
            "id": 2,
            "plate_title": "诗词",
            "plate_dp": null,
            "created_at": "2021-08-07 14:20:59",
            "updated_at": "2021-08-07 14:21:02",
            "status": 1
        },
        {
            "id": 3,
            "plate_title": "治愈",
            "plate_dp": null,
            "created_at": "2021-08-07 14:41:07",
            "updated_at": "2021-08-07 14:41:11",
            "status": 1
        },
        {
            "id": 4,
            "plate_title": "生活",
            "plate_dp": null,
            "created_at": "2021-08-07 14:41:26",
            "updated_at": "2021-08-07 14:41:28",
            "status": 1
        },
        {
            "id": 5,
            "plate_title": "句子",
            "plate_dp": null,
            "created_at": "2021-08-07 14:41:44",
            "updated_at": "2021-08-07 14:41:48",
            "status": 1
        },
        {
            "id": 6,
            "plate_title": "语录",
            "plate_dp": null,
            "created_at": "2021-08-07 14:42:01",
            "updated_at": "2021-08-07 14:42:03",
            "status": 1
        }
    ]
}


书写帖子API(需要登录)

  • 请求URL(POST)
/v1/plates/plate/api/dparticle
  • 请求参数
参数值类型描述
plate必填板块ID
post_title必填帖子标题
post_content必填帖子内容
label选填标签,已英文半角符号分开
  • 返回状态码Status=201

某一板块下帖子展示API

  • 请求URL(GET)
/v1/plates/plate/api/plate/article/list
  • 请求参数
参数值类型描述
plate_title必填板块标题
post_title选填模糊查询(文章标题)
page选填页码
limit选填每一页大小
  • 返回实例(Status=200)

{
    "data": {
        "meta": {
            "total_count": 11,
            "page_count": 3,
            "current_page": 1
        },
        "objects": [
            {
                "uid": 1,
                "user": "ZRR",
                "avatar": "http://localhost:8000/medias/avatar/20210814/79265620210814_104330.png",
                "plate_title": "治愈",
                "pid": 82,
                "post_title": "文章标题1",
                "post_content": "文章内容1",
                "created_at": "2021-08-15T01:21:11.201Z",
                "updated_at": "2021-08-15T01:21:11.201Z",
                "labels": []
            },
            {
                "uid": 1,
                "user": "ZRR",
                "avatar": "http://localhost:8000/medias/avatar/20210814/79265620210814_104330.png",
                "plate_title": "治愈",
                "pid": 81,
                "post_title": "文章标题1",
                "post_content": "文章内容1",
                "created_at": "2021-08-15T01:18:14.803Z",
                "updated_at": "2021-08-15T01:18:14.803Z",
                "labels": [
                    {
                        "id": 72,
                        "user_id": 1,
                        "label_title": "标签11",
                        "label_dp": null,
                        "created_at": "2021-08-15 01:18:14",
                        "updated_at": "2021-08-15 01:18:14",
                        "status": 1
                    },
                    {
                        "id": 73,
                        "user_id": 1,
                        "label_title": "标签21",
                        "label_dp": null,
                        "created_at": "2021-08-15 01:18:14",
                        "updated_at": "2021-08-15 01:18:14",
                        "status": 1
                    }
                ]
            },
            {
                "uid": 1,
                "user": "ZRR",
                "avatar": "http://localhost:8000/medias/avatar/20210814/79265620210814_104330.png",
                "plate_title": "治愈",
                "pid": 80,
                "post_title": "文章标题1",
                "post_content": "文章内容1",
                "created_at": "2021-08-15T01:17:20.730Z",
                "updated_at": "2021-08-15T01:17:20.730Z",
                "labels": [
                    {
                        "id": 70,
                        "user_id": 1,
                        "label_title": "标签11",
                        "label_dp": null,
                        "created_at": "2021-08-15 01:17:20",
                        "updated_at": "2021-08-15 01:17:20",
                        "status": 1
                    },
                    {
                        "id": 71,
                        "user_id": 1,
                        "label_title": "标签21",
                        "label_dp": null,
                        "created_at": "2021-08-15 01:17:20",
                        "updated_at": "2021-08-15 01:17:20",
                        "status": 1
                    }
                ]
            },
            {
                "uid": 1,
                "user": "ZRR",
                "avatar": "http://localhost:8000/medias/avatar/20210814/79265620210814_104330.png",
                "plate_title": "治愈",
                "pid": 79,
                "post_title": "文章标题1",
                "post_content": "文章内容1",
                "created_at": "2021-08-15T01:16:41.179Z",
                "updated_at": "2021-08-15T01:16:41.179Z",
                "labels": [
                    {
                        "id": 68,
                        "user_id": 1,
                        "label_title": "标签11",
                        "label_dp": null,
                        "created_at": "2021-08-15 01:16:41",
                        "updated_at": "2021-08-15 01:16:41",
                        "status": 1
                    },
                    {
                        "id": 69,
                        "user_id": 1,
                        "label_title": "标签21",
                        "label_dp": null,
                        "created_at": "2021-08-15 01:16:41",
                        "updated_at": "2021-08-15 01:16:41",
                        "status": 1
                    }
                ]
            },
            {
                "uid": 1,
                "user": "ZRR",
                "avatar": "http://localhost:8000/medias/avatar/20210814/79265620210814_104330.png",
                "plate_title": "治愈",
                "pid": 78,
                "post_title": "文章标题1",
                "post_content": "文章内容1",
                "created_at": "2021-08-15T01:16:03.923Z",
                "updated_at": "2021-08-15T01:16:03.923Z",
                "labels": [
                    {
                        "id": 66,
                        "user_id": 1,
                        "label_title": "标签11",
                        "label_dp": null,
                        "created_at": "2021-08-15 01:16:03",
                        "updated_at": "2021-08-15 01:16:03",
                        "status": 1
                    },
                    {
                        "id": 67,
                        "user_id": 1,
                        "label_title": "标签21",
                        "label_dp": null,
                        "created_at": "2021-08-15 01:16:03",
                        "updated_at": "2021-08-15 01:16:03",
                        "status": 1
                    }
                ]
            }
        ]
    }
}


收藏与取消收藏帖子及帖子列表API(需要登录)

  • 请求URL(POST,GET)
/plates/plate/api/collect/article/en/<int:pk>
  1. POST请求(收藏与取消收藏)
  • pk=pid
  • 返回(Status=200)取消收藏,返回(Status=201)收藏
  1. GET请求(获取收藏列表)
  • pk=limit(限制输出条数,默认5)
  • 返回实例(Status=200)

{
    "collect_list": [
        {
            "id": 1,
            "user_id": 1,
            "post_id": 75,
            "created_at": "2021-08-08 16:34:02",
            "updated_at": "2021-08-08 16:34:04",
            "status": 1
        },
        {
            "id": 2,
            "user_id": 1,
            "post_id": 73,
            "created_at": "2021-08-08 08:55:53",
            "updated_at": "2021-08-08 08:55:53",
            "status": 1
        },
        {
            "id": 3,
            "user_id": 1,
            "post_id": 72,
            "created_at": "2021-08-08 09:37:54",
            "updated_at": "2021-08-08 09:37:54",
            "status": 1
        }
    ]
}


获取热门列表API

  • 请求URL(GET)
/v1/plates/plate/api/hot/article/<int:pk>
  • pk=limit
  • 返回实例(Status=200)

{
    "hot": [
        {
            "id": 1,
            "title_id": 72,
            "created_at": "2021-08-08 10:04:01",
            "updated_at": "2021-08-08 10:04:01",
            "status": 1
        },
        {
            "id": 2,
            "title_id": 73,
            "created_at": "2021-08-08 10:04:25",
            "updated_at": "2021-08-08 10:04:25",
            "status": 1
        },
        {
            "id": 3,
            "title_id": 74,
            "created_at": "2021-08-08 10:04:34",
            "updated_at": "2021-08-08 10:04:34",
            "status": 1
        },
        {
            "id": 4,
            "title_id": 75,
            "created_at": "2021-08-08 10:04:41",
            "updated_at": "2021-08-08 10:04:41",
            "status": 1
        }
    ]
}


通过PID获取帖子API

  • 请求URL(GET)
/v1/plates/plate/api/article/detail/<int:pk>
  • pk=pid
  • 返回实例(Status=200)

{
    "uid": 1,
    "user": "ZRR",
    "avatar": "http://localhost:8000/medias/avatar/20210814/79265620210814_104330.png",
    "plate_title": "治愈",
    "post_title": "文章标题1",
    "post_content": "文章内容1",
    "created_at": "2021-08-08T03:02:25.952Z",
    "updated_at": "2021-08-08T03:02:25.952Z",
    "labels": [
        {
            "id": 56,
            "user_id": 1,
            "label_title": "标签11",
            "label_dp": null,
            "created_at": "2021-08-08 03:02:25",
            "updated_at": "2021-08-08 03:02:25",
            "status": 1
        },
        {
            "id": 57,
            "user_id": 1,
            "label_title": "标签21",
            "label_dp": null,
            "created_at": "2021-08-08 03:02:25",
            "updated_at": "2021-08-08 03:02:25",
            "status": 1
        }
    ]
}


系统模块API

文件上传与删除API(需要登录)

  • 请求URL(POST,DELETE)
  • POST请求(上传文件)
/v1/system/file/upload
  • 请求参数
参数值类型描述
pid选填帖子ID
file必填文件
  • 返回实例(Status=201)

{
    "file_id": 11,
    "file_post": "http://localhost:8000/medias/file/20210816/45714620210816_120041.png"
}

  • DELETE请求(删除文件)
  • 请求参数
参数值类型描述
pk必填文件ID
  • 返回实例(Status=201)

评论类API

一级评论API(需要登录)

  • 请求URL(POST,DELET)
/v1/comments/comment/api/comment/one/to
  • POST请求(一级评论)
  • 请求参数
参数值类型描述
pid必填帖子ID
content必填评论内容
  • 返回状态码Status=201
  • DELET请求(删除评论)
  • 请求参数
参数值类型描述
pk必填帖子ID
  • 返回状态码Status=200

二级评论API(需要登录)

  • 请求URL(POST,DELET)
/v1/comments/comment/api/comment/two/to
  • POST请求(一级评论)
  • 请求参数
参数值类型描述
comment_one必填一级评论ID
user_to必填被评论人ID
content必填评论内容
  • 返回状态码Status=201
  • DELET`请求(删除评论)
  • 请求参数
参数值类型描述
pk必填帖子ID
  • 返回状态码Status=200

评论获取API

  • 请求URL(GET)
  • 请求参数
参数值类型描述
pid必填帖子ID
page选填页码
limit选填限制条数
  • 返回实例(Status=200)

{
    "meta": {
        "total_count": 62,
        "page_count": 31,
        "current_page": 1
    },
    "objects": [
        {
            "pid": 72,
            "comment_one_id": 3,
            "comment_one_user_id": 1,
            "comment_one_user_nickname": "ZRR",
            "comment_one_user_avatar": "http://localhost:8000/medias/avatar/20210814/79265620210814_104330.png",
            "comment_two_all": [
                {
                    "id": 28,
                    "user_id": 1,
                    "comment_one_id": 3,
                    "user_to_id": 1,
                    "content": "二级评论",
                    "created_at": "2021-08-10 08:23:41",
                    "updated_at": "2021-08-10 08:23:41",
                    "status": 1
                },
                {
                    "id": 29,
                    "user_id": 1,
                    "comment_one_id": 3,
                    "user_to_id": 1,
                    "content": "二级评论",
                    "created_at": "2021-08-10 08:23:41",
                    "updated_at": "2021-08-10 08:23:41",
                    "status": 1
                },
                {
                    "id": 30,
                    "user_id": 1,
                    "comment_one_id": 3,
                    "user_to_id": 1,
                    "content": "二级评论",
                    "created_at": "2021-08-10 08:23:42",
                    "updated_at": "2021-08-10 08:23:42",
                    "status": 1
                }
            ]
        },
        {
            "pid": 72,
            "comment_one_id": 4,
            "comment_one_user_id": 1,
            "comment_one_user_nickname": "ZRR",
            "comment_one_user_avatar": "http://localhost:8000/medias/avatar/20210814/79265620210814_104330.png",
            "comment_two_all": []
        }
    ]
}


邮件类

发送公共邮件, 查询公共邮件API(需要登录)

  • 请求URL(POST,GET)
/v1/emaillist/emaillist/api/send/open/email
  • POST请求(发送公共邮件)
  • 请求参数
参数值类型描述
title必填邮件标题
content必填内容
audio选填音频URL
  • 返回状态码(Status=201)
  • GET请求(查询公共邮件)
  • 返回实例(Status=200)

{
    "open_email": [
        {
            "id": 1,
            "user_id": 1,
            "title": "公共邮件",
            "content": "公共邮件内容",
            "audio": "",
            "created_at": "2021-08-10 10:43:01",
            "updated_at": "2021-08-10 10:43:01",
            "status": 1
        },
        {
            "id": 2,
            "user_id": 1,
            "title": "公共邮件",
            "content": "公共邮件内容",
            "audio": "",
            "created_at": "2021-08-10 10:43:03",
            "updated_at": "2021-08-10 10:43:03",
            "status": 1
        },
        {
            "id": 3,
            "user_id": 1,
            "title": "公共邮件",
            "content": "公共邮件内容",
            "audio": "",
            "created_at": "2021-08-10 10:43:04",
            "updated_at": "2021-08-10 10:43:04",
            "status": 1
        },
        {
            "id": 4,
            "user_id": 1,
            "title": "公共邮件",
            "content": "公共邮件内容",
            "audio": "",
            "created_at": "2021-08-16 13:33:26",
            "updated_at": "2021-08-16 13:33:26",
            "status": 1
        },
        {
            "id": 5,
            "user_id": 1,
            "title": "公共邮件",
            "content": "公共邮件内容",
            "audio": "",
            "created_at": "2021-08-16 13:33:40",
            "updated_at": "2021-08-16 13:33:40",
            "status": 1
        },
        {
            "id": 6,
            "user_id": 1,
            "title": "公共邮件",
            "content": "公共邮件内容",
            "audio": "",
            "created_at": "2021-08-16 13:33:41",
            "updated_at": "2021-08-16 13:33:41",
            "status": 1
        }
    ]
}


发送私人邮件, 查询已发送和已收到邮件API(需要登录)

  • 请求URL(POST,GET)
/v1/emaillist/emaillist/api/send/open/email
  • POST请求(发送私人邮件)
  • 请求参数
参数值类型描述
to_user必填被邮件人
content必填内容
title必填标题
  • 返回状态码(Status=201)
  • GET请求(查询已发送和已收到邮件)
  • 返回实例(Status=200)

{
    "email": [
        {
            "id": 1,
            "user_id": 1,
            "user_to_id": 7,
            "title": "私人邮件",
            "content": "私人邮件内容",
            "created_at": "2021-08-10 10:47:55",
            "updated_at": "2021-08-10 10:47:55",
            "status": 1
        },
        {
            "id": 2,
            "user_id": 1,
            "user_to_id": 7,
            "title": "私人邮件",
            "content": "私人邮件内容",
            "created_at": "2021-08-16 13:42:01",
            "updated_at": "2021-08-16 13:42:01",
            "status": 1
        },
        {
            "id": 3,
            "user_id": 1,
            "user_to_id": 7,
            "title": "私人邮件",
            "content": "私人邮件内容",
            "created_at": "2021-08-16 13:42:45",
            "updated_at": "2021-08-16 13:42:45",
            "status": 1
        }
    ],
    "email_go_to": []
}

加载中
上午10:38 · 2021年08月31日
48
0
0
发表留言

学习
jinci后端接口
开源地址锦词接口文档APITOKEN说明md5(秘钥|time.time())|time.time()例子import requests i...
扫描右侧二维码继续阅读
August 31, 2021
小丸子好萌!
统计
文章:21 篇
分类:4 个
评论:10 条
运行时长:0年263天
by yoniu.
小丸子好萌!