14

tl;dr I would like to have a route to a badge based on the id in SEDE.

In SEDE we have a table Badges(Id, UserId, Name, Date, Class, TagBased).

For me the first few badges look like this:

Id      | UserId | Name           | Date              | Class | TagBased
------------------------------------------------------------------------
1361955 | 578411 | Autobiographer |2011-01-19 17:15:25|  3    | false
1367877 | 578411 | Teacher        |2011-01-21 15:16:02|  3    | false
1369965 | 578411 | Editor         |2011-01-22 13:47:17|  3    | false

I really want to create a link to those badges with functionality provided in SEDE. Unfortunately the link on Stack Overflow for my teacher badge is

https://stackoverflow.com/help/badges/1/teacher?userid=578411

We don't have that magic 1 between badges and teacher, which is confirmed by Tim Stone in The Tavern. It wouldn't all be that bad if those numbers were stable across the network (at least for the named badges) but they aren't

Note that badge ids are not constant across sites, and thus should be looked up via the /badges method. A badge id on a single site is, however, guaranteed to be stable.

I would have to write a script for the API to retrieve all badges from all sites and convert that to a SQL insert script...and that needs to be updated weekly to reflect any new badges....

This scenario would become much easier if there was a route that accepts the id from the badge table and would render the specific badge for the user. Something like this:

http://stackoverflow/badge/1367877

Does such route maybe already exist but is it not yet revealed? If this doesn't exist can this be considered to be added? Or add the master-badgeid to the badge table? Either solution will work and enable us to render a working link from SEDE for badges.

Until this is implemented we can use some javascript to get the badges from the StackAPI as shown here.

There are two requests (1,2) that ask for different behavior of the badge url but they don't solve this problem. My request doesn't invalidate those request.

2
  • The ID currently in the data dump is drawn from the internal table that maps users to badges. So it'd be easy enough to map one of those IDs to a userID and badgeID (for a given site), but I'm not aware of any route that currently does this. Depending on what you're trying to do, you might find that the API is a better tool for this.
    – Shog9
    Apr 29 '15 at 23:03
  • @Shog9 I was hoping to create links for the badgenames in this answer: meta.stackexchange.com/a/254596/158100. If I have the badgeid that will solve it as well
    – rene
    Apr 29 '15 at 23:37
1

While I cannot provide order, I can provide a table where the badge IDs are easy to look up manually or programmatically.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .