web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

How to temporary set the language during an API call ?

(1) ShareShare
ReportReport
Posted on by

Hello,

We are making an API that will return the value of an enum.

this enum has the labels in english and in french.

When the user calls the API, it appears that the language is by default set to english. Therefore, the returned values are in english. But we would like to have the french values instead. We noticed that using something like Swagger (with the user that has its language to french), the values are returned in french.

Can we tell in the class that we want to have the context of this call to be handled in french?

Thanks for the help. And please let me know if I am not clear.

I have the same question (0)
  • Nya Profile Picture
    29,060 on at
    RE: How to temporary set the language during an API call ?

    Hi,

    Would you please specify which application you're using in Dynamics?

    Then I'll move it to the proper forum for more help.

  • Happouh Profile Picture
    on at
    RE: How to temporary set the language during an API call ?

    Here is a link to the .net equivalent of what I am trying to do : docs.microsoft.com/.../system.globalization.cultureinfo.currentculture

    But I can't figure out a way to adapt it to X++.

  • Happouh Profile Picture
    on at
    RE: How to temporary set the language during an API call ?

    What do you mean by application?

    Thanks

  • Nya Profile Picture
    29,060 on at
    RE: How to temporary set the language during an API call ?

    Hi,

    Sorry for the unclear expressions.

    I mean that the specific applications in Dynamics, such as Sales, Customer Service or Finance & Operations and so on.

    You can find it in the following location.

    2627.pastedimage1629278398536v1.png

  • Happouh Profile Picture
    on at
    RE: How to temporary set the language during an API call ?

    Thanks, that is Finance and Operations.

  • Verified answer
    Martin Dráb Profile Picture
    236,513 Most Valuable Professional on at
    RE: How to temporary set the language during an API call ?

    API stands for Application Programming Interface, which might mean almost anything. It seems that you're talking about a REST web service, but it's not clear which web service. Could you clarify it, please? For example, don't you mean a custom service?

    The language is no normally taken from setup of the F&O user. In X++, the language can be set by calling infolog.language() (with the right argument), but I can't say yet if it can be used in your situation.

  • Happouh Profile Picture
    on at
    RE: How to temporary set the language during an API call ?

    Hi Martin,

    This is indeed a REST API that I use. I added the infolog.language(with a paramter), and that does what I expect.

    Thanks a lot.

  • Martin Dráb Profile Picture
    236,513 Most Valuable Professional on at
    RE: How to temporary set the language during an API call ?

    REST isn't a specific API - it's just an architecture pattern. There are likely millions of web services implemented with RESTful design.

    In F&O alone, you have hundred data entities accessible via OData (which uses RESTful desing), hundred custom services (which aren't actually RESTful) and the metadata service. Plus you can be using Dataverse, Azure APIs and many other things.

    When you have a question about a web service, it's very important to mention which service it is, otherwise everybody can be talking about completely different services. Plese keep it in mind in future.

  • Happouh Profile Picture
    on at
    RE: How to temporary set the language during an API call ?

    Thanks Martin, I will keep this in mind. However, I meant that I was using a custom REST API.

    Thanks again for your help.

  • Martin Dráb Profile Picture
    236,513 Most Valuable Professional on at
    RE: How to temporary set the language during an API call ?

    A custom custom API would mean any web service that you've developed by yourself by using RESTful design. The term "custom service" has a special meaning in F&O - it's one type of web services offered by F&O. And as I said, it's not even RESTful, although it does offer a JSON-based endpoint.

    Please refer to F&O documentation to learn about web services available in F&O. And you can find general information about REST at the internet, e.g. What is REST.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 1,850

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 795 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 519 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans