Skip to main content

Notifications

Dynamics 365 Community / Forums / Finance forum / X++ call to external API
Finance forum
Unanswered

X++ call to external API

Posted on by 293
Hello:
We have a software vendor running their application on one of our VM. Their application exposes a set of API's which I need to call from within F&O. I've not done this before and was looking for some guidance. The initial questions rattling in my head is how would I authenticate and build the GET request? Would I need to create an AOT service or can this all be done within X++ code? BTW, I've done some light testing with Postman for the specific API call I need. Any help (with as much detail) would be greatly appreciated. 
Thank you. 
Categories:
  • CU29041349-0 Profile Picture
    CU29041349-0 293 on at
    X++ call to external API
    Hi Martin,
     
    The vendor's API was built with Swagger (RESTful?). The .NET libraries you referenced, will they be used directly within X++ code? If I need to write C# code, then that's another hurdle for me. 
     
    To your question of accessibility from the internet, I'm not sure, to be honest. Because the application is running on our VM, I've been able to use the server's public IP to access the API from Postman on my personal laptop (no VPN connection required). In fact, I'm able to hit the URL I use in Postman with my Chrome browser, and I get an "invalid bearer token" error message back. It appears the API is accessible from the internet. 
     
    Thank you!
  • CU29041349-0 Profile Picture
    CU29041349-0 293 on at
    X++ call to external API
    Hi Layan,
     
    Unfortunately, I do not have any code at this point for review. This is an area I've not had any experience with. 
     
    Thank you. 
  • Martin Dráb Profile Picture
    Martin Dráb 229,173 Most Valuable Professional on at
    X++ call to external API
    How to use their API depends on how they implemented it, but you seem to already know that (if you're able to call it from Postman). The mention of Postman and GET shows that you're talking about a some kind of web service (and not other types of application programming interfaces).
     
    Let's discuss how to consume the web service after you give us more information about it (e.g. whether its a RESTful service, SOAP or so). In general, you'll typically use .NET libraries to handle communication.
     
    You won't define a service in AOT; that would be useful if you wanted to create a web service in F&O that other systems will call.
     
    Another important information is whether the web service is accessible from Internet (such as Azure data centers running F&O and whether it should be). If the answers are yes, you can directly call it from F&O, if not, you'll need a kind of reverse proxy. The proxy can also help you with authentication.
     
     
  • Layan Jwei Profile Picture
    Layan Jwei 7,179 Super User 2024 Season 2 on at
    X++ call to external API
    Hi,
     
    I think u can find lots of examples online.
     
    Maybe try this link
     
     
    If you did some code and it's not working then share the code with us and we can help
     

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,867 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 229,173 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans