问答系统api文档

注册api

/api/login?username=test1&password=123456

参数

username (required)
password (required)

如果用户名或者密码参数为空

{
status: 0,
msg: "用户名和密码皆不可为空"
}

如果用户名已经存在

{
status: 0,
msg: "用户名已经存在"
}

成功注册返回id

{
status: 1,
id: 10
}

 

登录api

/api/login?username=test1&password=123456

参数

username (required)
password (required)

如果用户名或者密码为空

{
status: 0,
msg: "用户名和密码皆不可为空"
}

密码不正确

{
status: 0,
msg: "密码不正确"
}

成功登录

{
status: 1,
msg: "登录成功"
}

 

退出登录api

/api/logout

{
status: 1,
msg: "登出成功"
}

 

评论api

添加评论

参数

question_id

answer_id

reply_to 

(三选一 必须) 优先级 question_id > answer_id >reply_to

content 必须

reply_to

/api/comment/add/content=reply_to测试回复&reply_to=4

question_id

/api/comment/add/content=reply_to测试回复&question_id=4

answer_id

/api/comment/add/content=reply_to测试回复&answer_id=4

question_id or answer_id or reply_id 都没有,返回

{
status: 0,
msg: "question_id or answer_id or reply_to is required"
}

没有content,返回

{
status: 0,
msg: "content is required"
}

不允许reply_to 自己的评论,返回

{
status: 0,
msg: "cannot reply to yourself"
}

成功评论,返回id

{
status: 1,
id: 6
}

 

转载于:https://my.oschina.net/xuyaoxiang/blog/782491

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值