Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Answered

Business central Consuming a third-party endpoint that Required certificate

Posted on by 85

Hi, 
I want to consume a third-party API in business central On-prem and the API has a requirement for Certificate, I have the certificate file and password but I am not able to use them. I have written code in C#, and it works correctly but I am not able to do the same in Business Central, here is my C# application code. 
pastedimage1670905961299v1.png

I am not able to understand how to pass this certificate in Business Central. I have written the code in AL but it's not working, I have explored some standard codeunit but not able to upload the certificate 

pastedimage1670906438580v2.png 
Anyone knows how to consume it, 
Best Regards 

  • Abdullah Zafar Profile Picture
    Abdullah Zafar 85 on at
    Business central Consuming a third-party endpoint that Required certificate

    Hi @Rebe.Gwaindepy
    This is indeed a great workaround, I have marked your reply as the answer., 
    Thanks for the valuable input.
  • Verified answer
    Rebe.Gwaindepy Profile Picture
    Rebe.Gwaindepy 162 on at
    Business central Consuming a third-party endpoint that Required certificate
    Hi Abdullah,
     
    Thanks for the response. The standard certificate management functionality does not work on SaaS. I managed to get it to work with a combination of both .Net and AL:
     
    • Use a .Net app or openssl to create a .pfx file of the certificate from the cert and key PEMs
    • Import the Certificate file manually and storing it in a custom Blob field:
    • Read the Blob and convert it to base64 to get certificate for http client
    • using the certificate with httpclient.addcertificate(certificate,password)
    I hopes this helps someone.
     
    Thanks
  • Abdullah Zafar Profile Picture
    Abdullah Zafar 85 on at
    Business central Consuming a third-party endpoint that Required certificate
    Hi @Rebe.Gwaindepy
    I resolved the issue, but It was for business central on-prem version, 
    I have replied to the post as well, you can take a look. 
  • Rebe.Gwaindepy Profile Picture
    Rebe.Gwaindepy 162 on at
    Business central Consuming a third-party endpoint that Required certificate
    Hi everyone,

    I have the same problem, @Abdullah did your AL solution work on SaaS? If yes, may you please assist me with how you management to save the certificate using BC functionality as well.

    Thanks,
    Kuda
  • Verified answer
    Abdullah Zafar Profile Picture
    Abdullah Zafar 85 on at
    RE: Business central Consuming a third-party endpoint that Required certificate

    Hi, Yes that is an option as well, but I managed to get the desired result from business central standard functionality for Certifications, I have upload then certificate in business central and then used Base64 of the certificate, Some procedures that I have used have scope of On-prem, anyone who is trying it in SAAS, need to be careful,

    [quote user="DAnny3211"]

    hi

    in my opinion you'd better develop a dll in C# and put it in the addins of BC on prem and do whatever you need to do

    learn.microsoft.com/.../devenv-dotnet-controladdins

    DAniele

    [/quote]
  • Suggested answer
    DAnny3211 Profile Picture
    DAnny3211 9,272 Super User 2024 Season 1 on at
    RE: Business central Consuming a third-party endpoint that Required certificate

    hi

    in my opinion you'd better develop a dll in C# and put it in the addins of BC on prem and do whatever you need to do

    learn.microsoft.com/.../devenv-dotnet-controladdins

    DAniele

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans