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

Notifications

Announcements

No record found.

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

I have the same question (0)
  • Suggested answer
    Shrey Chauhan Profile Picture
    284 on at

    You can refer this  

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

    or

    Custom Api

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

  • Suggested answer
    Inge M. Bruvik Profile Picture
    1,105 Moderator on at

    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
    YUN ZHU Profile Picture
    95,329 Super User 2025 Season 2 on at

    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

  • Meriah Profile Picture
    26 on at

    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

  • Meriah Profile Picture
    26 on at

    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

  • PConijn Profile Picture
    51 on at
    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).
     

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,226

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 2,047 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,257 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans