I'm writing an HTTP API to a publishing server, and I want resources with representations in multiple languages. A user whose client GETs a resource which has Korean, Japanese and Trad. Chinese representations, and sends
Accept-Language: en, ja;q=0.7 should get the Japanese.
One resource, identified by one URI, will therefore have a number of different language representations. This seems to me like a totally orthodox use of content negotiation and multiple resource representations.
But when each translator comes to provide these alternate language representations to the server, what's the correct way to instruct the server which language to store the representation under? I'm having the translators PUT the representation in its entirety to the same URI, but I can't find out how to do this elegantly.
Content-Language is a response header, and none of the request headers seem to fit the bill.
It seems my options are
- Invent a new request header
- Supply additional metadata in a multipart/related document
- Provide language as a parameter to the
Content-Typeof the request, like
I don't want to get into the business of extending HTTP, and I don't feel great about bundling extra metadata into the representation. Neither approach seems friendly to HTTP caches either. So option 3 seems like the best way that I can think of, but even then it's decidedly non-standard to put my own specific parameters on a very well established content type.
Is there any by-the-book way of achieving this?