2

Currently, the API doesn't specify what the associated Meta site is for a certain site (I'm talking about the stackauth.com/1.0/sites route). Sure, we could just prepend "meta." to the domain name, but that's not entirely reliable (it might be now, but it might not be in the future). I'm thinking about two possible solutions for this. Either include the meta site as a child of its parent site, like so:

"api_sites": [
    {
        "name": "Stack Overflow",
        "logo_url": "http://sstatic.net/stackoverflow/img/logo.png",
        "api_endpoint": "http://api.stackoverflow.com",
        "site_url": "http://stackoverflow.com",
        "description": "Q&A for professional and enthusiast programmers",
        "icon_url": "http://sstatic.net/stackoverflow/img/apple-touch-icon.png",
        "state": "normal",
        "styling": {
            "link_color": "#0077CC",
            "tag_foreground_color": "#3E6D8E",
            "tag_background_color": "#E0EAF1"
        },
        "meta": {
            "name": "Meta Stack Overflow",
            "logo_url": "http://sstatic.net/stackoverflowmeta/img/logo.png",
            "api_endpoint": "http://api.meta.stackoverflow.com",
            "site_url": "http://meta.stackoverflow.com",
            "description": "Q&A about the Stack Exchange engine powering these sites",
            "icon_url": "http://sstatic.net/stackoverflowmeta/img/apple-touch-icon.png",
            "state": "normal",
            "styling": {
                "link_color": "#3D3D3D",
                "tag_foreground_color": "#6F6F6F",
                "tag_background_color": "#E7E7E7"
            }
        }
    },
    // ...
]

...or just include the endpoint of the meta site in the main site (and viceversa?):

"api_sites": [
    {
        "name": "Stack Overflow",
        "logo_url": "http://sstatic.net/stackoverflow/img/logo.png",
        "api_endpoint": "http://api.stackoverflow.com",
        "site_url": "http://stackoverflow.com",
        "description": "Q&A for professional and enthusiast programmers",
        "icon_url": "http://sstatic.net/stackoverflow/img/apple-touch-icon.png",
        "state": "normal",
        "styling": {
            "link_color": "#0077CC",
            "tag_foreground_color": "#3E6D8E",
            "tag_background_color": "#E0EAF1"
        },
        "meta": "http://api.meta.stackoverflow.com"
    },
    {
        "name": "Meta Stack Overflow",
        "logo_url": "http://sstatic.net/stackoverflowmeta/img/logo.png",
        "api_endpoint": "http://api.meta.stackoverflow.com",
        "site_url": "http://meta.stackoverflow.com",
        "description": "Q&A about the Stack Exchange engine powering these sites",
        "icon_url": "http://sstatic.net/stackoverflowmeta/img/apple-touch-icon.png",
        "state": "normal",
        "styling": {
            "link_color": "#3D3D3D",
            "tag_foreground_color": "#6F6F6F",
            "tag_background_color": "#E7E7E7"
        },
        "meta_for": "http://api.stackoverflow.com"
    },
    // ...
]

I think this would be pretty useful.

3
  • 2
    yes - relying on heuristics for relating when it is not necessary smells like sun dried tuna. Commented Aug 8, 2010 at 11:55
  • 1
    /sites is kind of rough just due to there not being any meta (or even SE 2.0) sites when it was created. It'll be improved in the next version. Commented Aug 8, 2010 at 14:11
  • I like #2 - as it won't break the code I've already got for caching sites :) Commented Aug 9, 2010 at 0:38

2 Answers 2

1

I agree that there does need to be a way to link a site to its Meta, but I question your solution. What if someone wants to enumerate only Metas? What happens if an API for the chat.xxx sites gets created?

1
  • That's why it's [status-planned].. exact specs for this have not yet been established.
    – Felix
    Commented Aug 8, 2010 at 21:38
1

The new /1.1/sites route returns a related_sites collection.

Parent/meta relations are indicated with a relation of "parent" or "meta". Note that new relation types can be added at any time, but the meaning of them once added is guaranteed to be stable.

You must log in to answer this question.

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