Updates core-principles/content-negotiation.md

Auto commit by GitBook Editor
This commit is contained in:
apidesigner
2017-01-31 09:11:32 +00:00
parent d7f9ae8f62
commit 3137ffb24a
4 changed files with 32 additions and 2 deletions

View File

@@ -15,4 +15,5 @@
* [Loose Coupling](core-principles/loose-coupling.md)
* [Rules for Extending](core-principles/rules-for-extending.md)
* [Versioning](core-principles/versioning.md)
* [Content Negotiation](core-principles/content-negotiation.md)

View File

@@ -0,0 +1 @@
# Content Negotiation

View File

@@ -1,9 +1,9 @@
# Robustness
Every API implementation and API consumer MUST follow Postel's law:
> "Be conservative in what you send, be liberal in what you accept."
> _Be conservative in what you send, be liberal in what you accept._
>
> [John Postel](https://en.wikipedia.org/wiki/Robustness_principle)
> _ [John Postel](https://en.wikipedia.org/wiki/Robustness_principle)_
That is, send as little as possible and be tolerant as possible while consuming another service ([tolerant reader](https://martinfowler.com/bliki/TolerantReader.html)).

View File

@@ -1,2 +1,30 @@
# Versioning
> _The fundamental principle is that you cant break existing clients, because you dont know what they implement, and you dont control them. In doing so, you need to turn a backwards-incompatible change into a compatible one._
>
> _ [Mark Nottingham](https://www.mnot.net/blog/2011/10/25/web_api_versioning_smackdown)_
Any change to an API MUST NOT break existing clients.
## Representation Format Change
> A representation format is the serialization format (media type) used in request and response bodies and typically it represents a resource or its part, possibly with additional hypermedia controls.
A change to a representation format MUST follow the [Rules for Extending](core-principles/rules-for-extending.md).
If the change can't follow the Rules for Extending the representation format media type MUST be changed. If the media type has been changed the previous media type MUST be available via [Content Negotiation](core-principles/content-negotiation.md).
#### Example
Media type _before_ a breaking change:
```
application/vnd.example.resource+json; version=2
```
Media type _after_ a breaking change:
```
application/vnd.example.resource+json; version=3
```
## Resource Change