4 ms·
What do you think about the separation of Web sites and Web services (so-called APIs)? Shouldn't the Web site be the Web service, and offer multiple representat
by zedr 14y ago
What do you think about the separation of Web sites and Web services (so-called APIs)? Shouldn't the Web site be the Web service, and offer multiple representations of its endpoints?
As a trivial example, consider that I have a blog located at the URIL http://www.example.org/posts/ http://www.example.org/posts/
If I were to offer an API to other developers, I would have two options: 1) serve posts as `application/json` at the URI http://www.example.org/api/v1/posts http://www.example.org/api/v1/posts ; 2) serve both `text/html` and a `application/json` representations at the same URI http://www.example.org/posts http://www.example.org/posts , handling the desired mime-type and API version in the 'Accept' field of the HTTP request.
Which approach is better?