- Using our example application, pichat, let's imagine that we want to change the name of the message body from body to message_text. This presents a problem because our message service is designed to accept the following requests:
GET /messages?user_id=123GET /messages/123POST /messagesDELETE /messages/123
- In the case of the GET requests, the client will expect a JSON object with a field called body in the response. In the case of the POST request, clients will be sending payloads as the JSON objects with a field called body. We can't simply remove body because that would break existing clients, thus necessitating a change to the API version. Instead, we'll simply add the new field in addition to the old one, as follows: ...