Many of the API endpoints return urls, such as /questions/{id}
(which returns urls for question_timeline_url
, question_comments_url
, etc). However, the URL returned is a relative URL, like /questions/{id}/timeline
.
However, this URL is not relative to the API url. It's relative to a URL that we (potentially) don't know. Theoretically we could compute the base URL by removing the "api." subdomain, but I'm hesitant to hard-code this assumption into my framework.
So my question is:
Can I always assume that removing the "api." subdomain will result in the base url of the site? I understand that this is currently true for stackoverflow.com, meta.stackoverflow.com, etc, but will this always be true for every future StackExchange site?
edit S.Mark has pointed out that the API subdomain can't be relied upon. In which case:
Can we get the absolute URL instead?