Calling an external API from Microsoft Dynamics Nav

Neil picture Neil · Mar 16, 2015 · Viewed 7.5k times · Source

I am researching how to integrate Microsoft Dynamics NAV with my existing REST API (built on Django REST Framework). What I would like to do is trigger API calls from NAV to CRUD objects via the REST API.

Reading the web services docs for NAV, it seems clear that NAV can expose a web service for other software to consume from. But can NAV consume 3rd party APIs? In the web services examples documentation, it says:

Solutions that need to execute business logic or read data from Microsoft Dynamics NAV are candidates for Web service implementation. These can also be solutions that write data to Microsoft Dynamics NAV and validate the data using existing business logic.

Also, it gives the following example of how to use web services:

Execute any kind of business logic that is more easily developed and managed in Microsoft Dynamics NAV.

However, I don't see any examples of data writing. It doesn't seem that in the exposure of web service pages or codeunits, there's a way to make calls to 3rd party APIs and execute business logic with the data that comes back within NAV. Is this actually possible?

Answer

SeeSharp picture SeeSharp · Mar 17, 2015

Unfortunately not, no.

You do however have access to the full .NET framework from within the 'Development Client' of Dynamics NAV - When defining your variables select the Type of DotNet

It's far from perfect, so for larger tasks I'll create AddIns or completely external libraries (depending on version).

For something smaller like this I personally find it easiest to write it in C# as a small (console) app and the 'translate' it back into Dynamics NAV.