Hi All ,
Once again I am getting stuck with calling of API in MS Dynamics NAV in my Germany office so I
thought why not get a dive into the sea of API. And lets check what it is in reality.
Once again I am getting stuck with calling of API in MS Dynamics NAV in my Germany office so I
thought why not get a dive into the sea of API. And lets check what it is in reality.
What is an API ?
Google says API is an Application Programming Interface. A way which provides us a facility to get
data from another server.
But I cant understand now also. So lets get some diagrammatic view of an API.
I have a requirement from customer whenever a payment is done by a customer we need to check
whether the customer has a credit balance to buy the article if no then send the notification to
customer please contact the owner to increase your credit balance.
So here we were suggested to come with a solution of API we need to create one API which will be
used by Paypal developers to checks whether this transaction is allowed or not.
I hope you got the point that what is an API.
API is generally a program written to say outer world that we will give you your data just send me
the url for this requirement. In our example , my developed API will take the parameter of customer
No. and will check in our customer table below points :
1. Customer Exist or Not.
2. If Exist , check the credit balance and proceed.
I hope concept is clear and requirement is also clear.
So what NAV developers will do now , we will create codeunit and will check the conditions and
expose it to web service. But now we want to interpret with Paypal and they suggested API.
How to use API in NAV 2018?
First we will see how we can use then we will create API also.
Requirement from NAV Side :
1. Enable your NAV 2018 Admin for Soap and Odata Url.
If you want to go in more deep about API follow this video.
2. Search for API Setup page. Open it and click on Integrate API function it will populate all API present in NAV in Table API Web Service. This is new system table.
3. We can check the data in Page but we need to create one page for this , as I had created this page on table API Web Service.
Please check how to create page on this table if you dont know in NAV from MSDN.
Lets Run this page.
You can create a web service for this page and check the data for this on browser.
The result of the data will be in JSON Format.
These are the following APIs provided by NAV 2018.
How to call API of NAV?
This is the URL provided by MSDN:
http://<<Server Name>>:<<OData Port>>/<<Service Name>>/api/beta
For me its :
http://localhost:7048/DynamicsNAV110/api/beta
Hint : If you are not familiar with the url just open web service page and click on URL fields. There are 3 fields
ODATA V4 URL
ODATA URL
SOAP URL
With this you will get the desired URL for your system I followed the same.
After some time the result is as in Screen.
Now if its an API URL it should be present in POSTMAN. Lets check there also the result of our API data is it available to other world.
For this I will write a new POST.
But I get 1 point now Microsoft is going to Business Central to a next Level of Data Library.