RESTful API: How to handle translated textfields in representations?
- by Jan P.
I am designing a RESTful API for a booking application. There are accommodations that you can request a list or the details. As the application targets a multi-language audience, the descriptions are (sometimes) available in different languages.
Now I'm not sure how to handle these translations in the representation of an accommodation. Without the multiple languages I would make "description" a field or the accommodation object, quite simple.
Any idea how to solve this elegantly?
My current idea: Add a list of descriptions with text<-culture pairs instead of the description field and an additional subressource /descriptions to the accommodation for the creating (POST), updating (PUT) and deleting (DELETE) of new translations.