web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :

NAV/BC OData with JSON and postman

Yannick Soldati Profile Picture Yannick Soldati 5

Building applications to work with NAV/BC is a pretty good idea. When customization becomes too difficult, creating a new app may be the good solution. To do so, you're not alone, Webservices are there to help you. Because NAV/BC is a Microsoft Product, the simplest way to do so is to use SOAP webservices. Then developing a visual studio project and using web references that point to these webservices is pretty easy. I'm not going to explain how to configure web services in NAV/BC, Microsoft does that well. I'm also not explaining how to use SOAP webservices.

One of my customer was not interested in using Visual Studio to develop his specific application. His idea was to use a REST communication and to see how it works, he proposed me to use the postman application. His target was simple, I wanna see GET and PUT methods using JSON in my postman application.

Is it that simple?

First of all, when using web services, the best way for authentication is to use NTLM. In the NAV/BC configuration program you can activate it. Don't forget to restart the NAV service.

The get method is not that difficult, you may need to know how to use filter expressions (https://docs.microsoft.com/en-us/dynamics-nav/using-filter-expressions-in-odata-uris). In postman, fill in the authorization. You need to specify that you are using NTLM and then enter your credentials.

In the header, in order to use JSON add the accept key with application/json as the value.

GET.PNG

Let's talk about the put method, it is quite the same for the URL but you need to specify the E-Tag to tell NAV which version of the record you're changing. You're getting the E-tag with the GET method.

You need to put the E-tag in the header using the If-Match key. The E-tag needs to be encapsulated between W/"'E-Tag'".

PUT1.PNG

The E-tag also need to be part of the JSON body.

PUT2.PNG

That's it!

Enjoy!

Comments

*This post is locked for comments