Question:create

注意:该接口需要登陆后才能调用。

content_markdowncontent_rendered 两个参数仅传入其中一个即可, 若两个参数都传入,则以 content_markdown 为准。

HTTP 请求

POST /api/questions

参数

参数名参数位置类型默认值说明
includequerystring

响应中需要包含的关联数据,用 , 分隔。可以为 user, topics, is_following, voting

请求体

请求体类型:application/json

示例

{
  "title": "请问作者开发了哪些软件?",
  "topic_ids": [ 1, 2, 3 ],
  "content_markdown": "如题",
  "content_rendered": "<p>如题</p>"
}

参数说明

参数名必选类型说明
titlestring

标题

topic_idsarray
content_markdownstring

Markdown 格式的正文

content_renderedstring

HTML 格式的正文

响应

提问详情

示例

{
  "code": 0,
  "data": {
    "question_id": 1,
    "user_id": 1,
    "title": "请问作者开发了哪些软件?",
    "content_markdown": "如题",
    "content_rendered": "<p>如题</p>",
    "comment_count": 6,
    "answer_count": 18,
    "follower_count": 12,
    "vote_count": 44,
    "vote_up_count": 96,
    "vote_down_count": 52,
    "last_answer_time": 1563512214,
    "create_time": 1563512214,
    "update_time": 1563512214,
    "delete_time": 0,
    "relationships": {
      "user": {
        "user_id": 1,
        "username": "zdhxiong",
        "headline": "mdui作者",
        "avatar": {
          "original": "https://mdclub.org/user-avatar/c4/ca/bc03445db47540eea79148252e7a91fe.jpg",
          "small": "https://mdclub.org/user-avatar/c4/ca/bc03445db47540eea79148252e7a91fe_small.jpg",
          "middle": "https://mdclub.org/user-avatar/c4/ca/bc03445db47540eea79148252e7a91fe_middle.jpg",
          "large": "https://mdclub.org/user-avatar/c4/ca/bc03445db47540eea79148252e7a91fe_large.jpg"
        }
      },
      "topics": [
        {
          "topic_id": 1,
          "name": "MDClub",
          "cover": {
            "original": "https://mdclub.org/topic-cover/c4/ca/bc03445db47540eea79148252e7a91fe.jpg",
            "small": "https://mdclub.org/topic-cover/c4/ca/bc03445db47540eea79148252e7a91fe_small.jpg",
            "middle": "https://mdclub.org/topic-cover/c4/ca/bc03445db47540eea79148252e7a91fe_middle.jpg",
            "large": "https://mdclub.org/topic-cover/c4/ca/bc03445db47540eea79148252e7a91fe_large.jpg"
          }
        }
      ],
      "is_following": true,
      "voting": "up"
    }
  }
}

参数说明

参数名 类型 说明
code integer

无任何错误时,状态码为 0

data.question_id integer

提问ID

data.user_id integer

用户ID

data.title string

提问标题

data.content_markdown string

Markdown 格式的提问内容

data.content_rendered string

HTML 格式的提问内容

data.comment_count integer

评论数量

data.answer_count integer

回答数量

data.follower_count integer

关注者数量

data.vote_count integer

投票数(赞成票 - 反对票,可能为负数)

data.vote_up_count integer

赞成票总数

data.vote_down_count integer

反对票总数

data.last_answer_time integer

最后回答时间

data.create_time integer

创建时间

data.update_time integer

更新时间(更新提问本身,或在提问下发表回答,都会更新该字段)

data.delete_time integer

🔐删除时间

data.relationships.user.user_id integer

用户ID

data.relationships.user.username string

用户名

data.relationships.user.headline string

一句话介绍

data.relationships.user.avatar.original string

头像原图地址

data.relationships.user.avatar.small string

小头像地址

data.relationships.user.avatar.middle string

中头像地址

data.relationships.user.avatar.large string

大头像地址

data.relationships.topics[].topic_id integer

话题 ID

data.relationships.topics[].name string

话题名称

data.relationships.topics[].cover.original string

封面原图地址

data.relationships.topics[].cover.small string

小型封面地址

data.relationships.topics[].cover.middle string

中型封面地址

data.relationships.topics[].cover.large string

大型封面地址

data.relationships.is_following boolean

当前登录用户是否已关注该提问

data.relationships.voting string

当前登录用户的投票类型(updown),未投过票则为空字符串

取值范围包括:up, down,