6

Most Stack Exchange sites are subdomains of stackexchange.com. However, some aren't. What are the list of those that aren't?

Right now I just know stackoverflow.com, superuser.com, serverfault.com, and askubuntu.com.

5

1 Answer 1

11

You can find that by leveraging the Stack API using the REST /sites endpoint.

From the description:

Returns all sites in the network.

This method allows for discovery of new sites, and changes to existing ones. Be aware that unlike normal API methods, this method should be fetched very infrequently, it is very unusual for these values to change more than once on any given day. It is suggested that you cache its return for at least one day, unless your app encounters evidence that it has changed (such as from the /info method).

It returns a JSON structure like this (filtered on site_url and aliases):

{
  "items": [
    {
      "aliases": [
        "http://www.stackoverflow.com",
        "http://facebook.stackoverflow.com"
      ],
      "site_url": "http://stackoverflow.com",
      "name": "Stack Overflow"
    },
    {
      "site_url": "http://serverfault.com",
      "name": "Server Fault"
    },
    {
      "site_url": "http://superuser.com",
      "name": "Super User"
    },
    {
      "site_url": "http://meta.stackexchange.com",
      "name": "Meta Stack Exchange"
    },
    {
      "aliases": [
           "http://nothingtoinstall.com"
       ],
      "site_url": "http://webapps.stackexchange.com",
      "name": "Web Applications"
    },
    {
      "site_url": "http://meta.webapps.stackexchange.com",
      "name": "Web Applications Meta"
    },
    {
      "site_url": "http://gaming.stackexchange.com",
      "name": "Arqade"
    },
    .... many more
   {
      "site_url": "http://askubuntu.com",
      "name": "Ask Ubuntu"
    },
    {
      "site_url": "http://meta.askubuntu.com",
      "name": "Ask Ubuntu Meta"
    }
  ],
  "has_more": true,
  "quota_max": 10000,
  "quota_remaining": 9987
}

For convenience I've created the following stack-snippet that produce an easy to consume HTML table as a result of running the snippet.

function addSiteRow(target, site) {
    var i,
        siterow,
        cell,
        ul,
        li;
   siterow = document.createElement('tr');
   cell = document.createElement('td');
   cell.textContent = site.name;
   siterow.appendChild(cell);
   cell = document.createElement('td');
   cell.textContent = site.site_url;
   siterow.appendChild(cell);
   cell = document.createElement('td');
   if (site.aliases && site.aliases.length > 0) {
      ul = document.createElement('ul');
      for(i = 0; i < site.aliases.length; i = i + 1) {
        li = document.createElement('li');
        li.textContent = site.aliases[i];
        ul.appendChild(li);
      }
      cell.appendChild(ul);
   }
   siterow.appendChild(cell);
   target.appendChild(siterow);
}


var xhr = new XMLHttpRequest();

xhr.open('GET','https://api.stackexchange.com/2.2/sites?pagesize=500&filter=!SmNnfVWqow2tl*.eJo');

xhr.onreadystatechange = function() {
  if (xhr.readyState === XMLHttpRequest.DONE) {
    var sites = JSON.parse(xhr.responseText),
        result = document.getElementById('result'),
        site,
        i;
    
    for(i=0; i < sites.items.length; i = i + 1) {
      site = sites.items[i];
      addSiteRow(result, site);
    }
  }  
};

xhr.send();
ul { 
  padding:0px;
  margin:0px;
    }
td {
  border-top: solid blue 1px;
  }
<table>
  <thead>
    <tr>
      <th>Site</th>
      <th>Url</th>
      <th>Alias</th>
    </tr>
  </thead>
  <tbody id="result">
  </tbody>
</table>

7
  • So it seems that the 4 that i listed are in fact the only ones with their own domains.
    – Scimonster
    Commented Oct 1, 2014 at 20:40
  • 3
    There are also some aliases. arqade.com goes to gaming.stackexchange.com, askdifferent.com -> apple.stackexchange.com. Possibly others, I forget the whole list now.
    – Adam Lear StaffMod
    Commented Oct 1, 2014 at 21:08
  • To get all sites, pagesize parameter should be set to something large... 300 is safe for now, 1000 for the foreseeable future.
    – user259867
    Commented Oct 2, 2014 at 11:35
  • @CareBear I thought 100 was the max? Commented Oct 2, 2014 at 11:36
  • 1
    @JanDvorak It is, except for the /sites method.
    – user259867
    Commented Oct 2, 2014 at 11:36
  • @Scimonster There's a fifth one: mathoverflow.net
    – Stijn
    Commented Oct 2, 2014 at 14:20
  • @Stijn Yes, Care Bear already commented as such on the question. Thanks anyways!
    – Scimonster
    Commented Oct 2, 2014 at 14:21

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