4 ms·
Media types help in one dimension (data model) but they don't give you a complete definition of an API. Also - people aren't actively promoting and re-using the
by njyx 13y ago
Media types help in one dimension (data model) but they don't give you a complete definition of an API. Also - people aren't actively promoting and re-using them. The main aim here is to try bring the things which are clearly copyright free out into the open so they can be re-used and evolved. This doesn't happen in the REST API space at all right now.
- smizell 13y agoI would say media types don't give you a full definition [1] because they really aren't meant to do so. They are meant to be used to express resources in a certain way that clients and servers can understand them. Additionally, your resources should be described through link relations, which, along with media types, allow your API to be self describing and discoverable. Take, for example, the Business API that is listed on the site [2] and picture Collection+JSON [3] being used to represent the business collection resource and the business item resource. If you used Collection+JSON, what would be left to describe? It would seem like you wouldn't need a Swagger file because your API would be describing itself. Lastly, even though media types may not be actively promoted or used at this time, I think we should push toward promoting really good hypermedia types. Edit: I wanted to also add a couple other interesting media types to check out, HAL [4] and Siren [5]. I'm sure there are other really good ones, too. [1] By definition I'm taking it to mean fully describing an API. [2] https://github.com/ongithub/businesses/blob/gh-pages/businesses https://github.com/ongithub/businesses/blob/gh-pages/busines... [3] http://amundsen.com/media-types/collection/ http://amundsen.com/media-types/collection/ [4] http://stateless.co/hal_specification.html http://stateless.co/hal_specification.html [5] https://github.com/kevinswiber/siren https://github.com/kevinswiber/siren