API: Who can tell me about the badges' attributes array?

When posting or requesting a badge, what it the attributes array for and how does it work? Asking for a prospect.

https://rhys.vanillademo.com/api/v2/badges/


    {
        "badgeID": 3,
        "type": "Timeout",
        "key": "combo",
        "name": "Combo Breaker",
        "body": "Earned badges for 5 different things in one day (now you can say it was 6!).",
        "photoUrl": "https://badges.v-cdn.net/svg/combo-breaker.svg",
        "points": 5,
        "enabled": true,
        "canDelete": false,
        "countUsers": 0,
        "class": null,
        "classLevel": null,
        "insertUserID": 1,
        "dateInserted": "2019-02-19T22:05:48+00:00",
        "updateUserID": null,
        "dateUpdated": null,
        "attributes": {
            "timeout": 86400,
            "threshold": 5
        },
        "url": "/badge/3/combo"
    },

Thanks

Answers

  • That combo breaker one is special. You get it if you earn some number of other badges in one day. So the attribute has a timeout and a threshold to keep track. For the most part, the attributes column holds info that only pertain to certain badges (so we don't use more columns in the db). So badges that rely on the number of comments will have a column attribute that is set to CountComments. An answer badge will have a 'column: countAcceptedAnswers' attribute. And so on. I think there's also an attribute if the badge can be awarded manually.

  • Thank you, that's about what I suspected. Can I create a custom badge (via the API) using this system? i.e. a custom badge that gets automatically applied based on a timeout and threshold.