Response Formatting
Response Formatting
When handling a RESTful API request, an application usually takes the following steps that are related with response formatting:
- Determine various factors that may affect the response format, such as media type, language, version, etc. This process is also known as content negotiation.
- Convert resource objects into arrays, as described in the Resources section. This is done by yii\rest\Serializer.
- Convert arrays into a string in the format as determined by the content negotiation step. This is done by 登录查看完整内容