Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested answer

Connect to external API from Business central

(0) ShareShare
ReportReport
Posted on by 26

Hello,

I need to connect to an external application and send master data (customer, contact,...) from business central to their interface through API.

With discussing with the external partner, I discovered they used a different type of authentication than OAuth2 or Basic Auth .
You will find below the script that I lmust launch in Postman at each API call to get the token .

pastedimage1682504370299v2.pngpostman-body.png

Could you tell me if I can run this script via Business Central to request their API and send my data ?

Thanks

  • PConijn Profile Picture
    51 on at
    Connect to external API from Business central
    I don't know if you have already solved this, but there is a good post by Arend Jan Kaufmann on the subject (with example code).
     
  • Meriah Profile Picture
    26 on at
    RE: Connect to external API from Business central

    Finally, I succeeded to get the token json response file, but how can I get the token value to save it and use it later ?

    Explanation :

    1/I sent Json request (AL function)

    {"method":"login",

    "params":{

    "login":"XXXXX@XXXX.com",

    "hash":"0e39d0c214eb0d2257e4c8004a24da89258a7d02",

    "timestamp":1683294731

    }}

    2/I got Json response (AL Function) but I need retreive the token value .

    {"jsonrpc":"2.0",
    "result":{
    "authToken":{
    "credId":98903,
    "login":"XXXXX@XXXXX.com",
    "end":1683298331,
    "type":"basic",
    "hash":"85d26fcdc118c7375b1a8ea1d17deac576ef2142"
    },
    "login":"XXXXX@XXXXXX.com",
    "id":98903,
    "userId":98723,
    "uniqueUserId":"stage_98723"
    },
    "id":null
    }

    If I do the same thing in postman, I have a token value in authToken var . And I need to get this value in Business Central.

    5305.postman1.png                            7206.postman2.png

    Any idea ?

    Thanks

  • Meriah Profile Picture
    26 on at
    RE: Connect to external API from Business central

    Hello,

    Thank you for all your answers.

    @YUN ZHU : I need to write data from BC to the external tool, not a fetching data from BC .

    So I need to connect to the external api and send data in json format .

    I will try to use the HttpClient Data Type ...and keep you informed .

    Thanks

  • Suggested answer
    YUN ZHU Profile Picture
    84,346 Super User 2025 Season 1 on at
    RE: Connect to external API from Business central

    Hi, just to add some info.

    I'm not sure what the external application is, if it's fetching data from BC, please note that Basic Auth is no longer available in the SaaS version, including in the Sandbox environment. More details: https://yzhums.com/37488/

    You can use HttpClient Data Type to do it. 
    https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/httpclient/httpclient-data-type

    In addition, there are a few simple examples below, hoping to give you some hints.

    https://yzhums.com/21873/

    https://yzhums.com/33195/

    Thanks.

    ZHU

  • Suggested answer
    Inge M. Bruvik Profile Picture
    1,029 Moderator on at
    RE: Connect to external API from Business central

    yes you can do that. You can either do it using Power Automate or you can do it writing AL code.

    AL have a built in Http client that will handle this perfectly fine.

    Here is documentation on the http client.

    learn.microsoft.com/.../httpclient-data-type

  • Suggested answer
    Shrey Chauhan Profile Picture
    276 on at
    RE: Connect to external API from Business central

    You can refer this  

    learn.microsoft.com/.../enabling-apis-for-dynamics-nav

    or

    Custom Api

    learn.microsoft.com/.../devenv-develop-custom-api

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

Jainam Kothari – Community Spotlight

We are honored to recognize Jainam Kothari as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 1,452

#2
YUN ZHU Profile Picture

YUN ZHU 1,313 Super User 2025 Season 1

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 1,083 Most Valuable Professional

Featured topics

Product updates

Dynamics 365 release plans