Показать сообщение отдельно
Старый 29.01.2018, 11:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
saurav-nav: Microsoft Dynamics NAV 2018 - API Part 3 - Consuming API.
Источник: http://saurav-nav.blogspot.com/2018/...pi-part-3.html
==============

Hi Readers,

We already have two posts about NAV 2018 API listed below -

Microsoft Dynamics NAV 2018 - API Part 1.

Microsoft Dynamics NAV 2018 - API Part 2 - Configure API.


In this article, we will see how we can consume these APIs. For the Demo, I will use Google Chrome App called Postman. I am sure there are great developers out there who know how to consume it but I just wanted to test how it is consumed.

If you are interested in the small demo using Postman then please go further otherwise, i am sure you know how to consume these APIs.



1. Download Google Chrome App "Postman" using this link.

2. Launch App from Google Chrome window.


3. Close first popup/splash screen in-app. We can see that there are so many options (15) to choose from. But I was able to find out that NAV API only support 2 options - GET and POST.

GET is used to read data from NAV API.
POST is used to write data in NAV using APIs.


4. I am choosing one of the API from 44 APIs that we see in the last post. Lets select paymentMethods as highlighted below.



Base URL - http://localhost:11048/DynamicsNAV110/api/beta
Name - paymentMethods

So URL To use in POSTMAN - http://localhost:11048/DynamicsNAV11...paymentMethods

5. Let's try to use GET and compare data with NAV. In NAV Entity is Page - 5486 "Payment Methods Entity".

6. Now let's try to use the POST statement and check data in NAV.
If we choose to post and try to click Send it will not work obviously as it will require some data (at least primary key), as shown below.


Now I am comfortable with JSON, you can choose other forms based on your comfort and assigned value to - code and description. The code is code in API and Description is displayName in API.

In postman select the Body tab, select raw and you can select any of 7 formats. I will select JSON and enter values for both parameters and then click send.

** Just to remember all these are case sensitive.



7. Let's check data in NAV table. Here is what we got in NAV using the POST.


Hope you find the information useful and will be able to consume API In your environment.

In Next article, we will try to create a New simple API. If you have some thoughts please let me know.

Let me know your views.

Regards,
+Saurav Dhyani - Microsoft Dynamics Navision
saurav-nav.blogspot.in


Источник: http://saurav-nav.blogspot.com/2018/...pi-part-3.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.