在使用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://stackoverflow.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=stackoverflow
时,URL 如下所示。
https://api.stackexchange.com/2.2/answers/43919322?order=desc&sort=activity&site=stackoverflow&filter=withbody&access_token=#####&key=#####
如果要使用 curl 检索数据,可以使用此选项。
curl "https://api.stackexchange.com/2.2/answers/43919322?order=desc&sort=activity&site=stackoverflow&filter=withbody&access_token=#####&key=#####" | gunzip
参考:
- http://api.stackexchange.com/docs/filters
如果我误解了你的问题,我很抱歉。