RESTfully request sub-parts of a representation be of a certain content-type
- by Grayside
I am requesting (via Accept: application/json) that an API I'm designing respond as JSON. However, I want the values within that JSON to be specified to conform to text/plain or text/html depending on the capabilities of the client.
What is the RESTful best practice for a "sub-type"? How would this work if I formally switched to HAL as the top-level container?
Accept: application/json+text/plain
{
"value": "Hello World"
}
Accept: application/json+text/html
{
"value": "<h2>Hello World</h2>"
}