1

I can get the badge id for a specific user, for example query:

Select *
From Badges
Where UserId = 10907521

Example badge id from result

30884218

But, how is it possible to get the associated question or answer id (if applicable) for every badge awarded to a user?
For those badges which are not related to a Q&A, we could expect an "NA".

4

1 回答 1

1

徽章奖励和帖子在 SEDE 中没有关联;该信息在数据资源管理器中不可用。

您可以从 API 中获取它,尽管它并不漂亮。
参考:

例如,获取:

    /users/10907521/timeline?pagesize=100&site=stackoverflow

返回结果如下:

{
  "badge_id": 10,
  "post_id": 54438094,
  "user_id": 10907521,
  "timeline_type": "badge",
  "post_type": "question",
  "creation_date": 1548848111,
  "detail": "Scholar",
  "title": "Execute a command and save the results into a df from a loop"
}

badge_id一旦您在结果中过滤/搜索

于 2019-07-05T01:51:10.813 回答