Expose Category and Group IDs to admins

Hi, I think it would make it easier for admins to edit data explorer queries if it was easier to find Category and Group IDs. If this information was made visible to accounts with admin status it wouldn’t bother most people while making it simple to find for those who need access.

Alternatively, in the meantime, if there are already easy ways to find Category and Group IDs, I’m eager to learn how to find this information.

1 „Gefällt mir“

I’ll admit it’s not super easy to find if you don’t know where to look, but here’s a couple ways:

  • Data Explorer query:

    SELECT name, id FROM categories ORDER BY name
    
  • via categories.json

    curl https://meta.discourse.org/categories.json | jq '.category_list.categories[] | [.name,.id]'`
    …info for all categories…
    
    curl https://meta.discourse.org/categories.json | jq '.category_list.categories[] | select(.name == "feature").id'
    2
    
  • via the JS console in the browser, e.g.:

    > Discourse.Category.findBySlug('feature').id
    2
13 „Gefällt mir“

For Data Explorer queries, you can use a pattern similar to the WHERE statement in this query to avoid having to lookup category or group ids:

--[params]
-- string :category_name

SELECT
id AS topic_id
FROM topics t
WHERE t.category_id = (SELECT id FROM categories WHERE name = :category_name)
7 „Gefällt mir“

Ich stoße dieses Thema erneut an, da ich dieselbe Frage hatte. Bei Kategorien ist es relativ einfach, sich die URL anzusehen:

https://meta.discourse.org/c/announcements/67
                                           ^^

Aber ich kann nichts Ähnliches für Gruppen finden. Ein idealer Ort dafür wäre auf der Gruppenprofilseite (/g/[group_name]/manage/profile). Es ist natürlich kein großes Problem (Data Explorer ist meine Sicherheitsdecke), aber es ist ärgerlich, wenn man mit der API arbeitet.

Für alles, was eher intern ist, können Sie einfach .json an eine URL anhängen. Funktioniert auch für diese lästigen Post-IDs.

2 „Gefällt mir“

Meine Stimme für den Daten-Explorer wäre für mehr Parameter im Stil von user_id, wie diese Feature request für Gruppen:

5 „Gefällt mir“