function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
vlad testingvlad testing 

How to get error messages from REST API in English language

Hello guys!

If Salesforce language is not English, I have some problems with response from REST API.

For example, if Salesforce language is English than I get a response in English and it's good for me cause I can handle this error and fix it
[
    {
        "message": "test, test does not have an accessible email address.",
        "errorCode": "INVALID_EMAIL_ADDRESS",
        "fields": [
            "CcAddress"
        ]
    }
]

But if our user uses the French language like main Salesforce`s language, then we have some problems with response
[
    {
        "message": "test, test n'a pas d'adresse e-mail accessible.",
        "errorCode": "INVALID_EMAIL_ADDRESS",
        "fields": [
            "CcAddress"
        ]
    }
]

We need to have a response error message in English for success handling errors from REST API.

I try to use Accept-Language header, but it did not work for me.

I don't want to write "flexible solutions" like "if" for separated language  to solve this issue.

Can you help me with it?
 
Dushyant srivastava 8Dushyant srivastava 8
HI Viad,

Not sure but this might help Retrieve Knowledge Language Settings (https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_knowledge_retrieve_language.htm)

Best Regards
Dushyant Srivastava
Jagrati Lalwani 6Jagrati Lalwani 6

Hi Vlad -

Did you get any generic solution for this?

vlad testingvlad testing
Hey!
I am sorry, but not.

we have started hardcode all error messages in all languages.

it is so sad, I know