I want my resources to be localized in several languages. How should multiple languages be sent to a resource using the REST architecture?
resource: / chapters, / chapters /: id
When POST is issued in chapters, the client send data structure:
{localizations: { en: {title: 'New chapter' },sk: {title: 'Nova kapitola'} }}
and a new chapter is created with the localizations of en and sk.
When a client wants to access this chapter at URL / chapter / 1, only one language mutation should be returned in the view. How should I have a domain of language definition? I can use the Accept-Language HTTP header with the desired locale, Accept-Language: sk, or I can include the locale in the url like / chapters / 1 / en.
Also, how to handle a PUT request? In most cases, only one language mutation is updated, but occasionally 2 or more of them will be updated.
Peter source share