堆栈交换 API

Stack Exchange API

得到答案with API后,我们得到一个没有实体的对象

{
  "items": [
    {
      "owner": {
        "reputation": 31,
        "user_id": 7256724,
        "user_type": "registered",
        "profile_image": "https://i.stack.imgur.com/pQ5II.jpg?s=128&g=1",
        "display_name": "Dzinot",
        "link": "https://whosebug.com/users/7256724/dzinot"
      },
      "is_accepted": false,
      "score": 2,
      "last_activity_date": 1494515438,
      "creation_date": 1494515438,
      "answer_id": 43919322,
      "question_id": 18987292
    }
  ],
  "has_more": false,
  "quota_max": 10000,
  "quota_remaining": 9401
}

如何接收答案正文?

您可以通过添加 filter=withbody 的查询参数来检索正文。比如你的问题URL中使用/2.2/answers/43919322?order=desc&sort=activity&site=Whosebug时,URL如下。

https://api.stackexchange.com/2.2/answers/43919322?order=desc&sort=activity&site=Whosebug&filter=withbody&access_token=#####&key=#####

如果你想使用 curl 检索数据,你可以使用这个。

curl "https://api.stackexchange.com/2.2/answers/43919322?order=desc&sort=activity&site=Whosebug&filter=withbody&access_token=#####&key=#####" | gunzip

参考:

如果我误解了你的问题,我很抱歉。