I just started creating a multilingual REST API and am not sure if there is any agreement on how to integrate multilingualism correctly.
Below is a list of alternatives that I came up with, not knowing what makes sense.
Option 1:
URI language variable: http://myapi.com/en/users/john
Option 2:
Returning only error codes for the translation side: GET http://myapi.com/users/john => HTTP 404 {status: false, error_code: "321"}
Option 3:
Returns in all available languages: GET http://myapi.com/users/john => {status: false, error_en: "User not found", error_sv: "Anvandaren finns inte"}
source share