Recently, and inspired by a NAV development training I have been looking for a way to consume data from Microsoft Dynamics NAV by the iOS platform. I found out that it is quite simple to expose data as JSON from NAV2013. Because I like to build stuff for iOS I was particular-airy interested in the possibilities.
It takes a few simple steps to download a JSON document from Navision using a webbrowser:
- Create a web service based on a page (my example show some seminar data from the training I did)
- Publish the new webservice
We need the OData URL, copy the complete URL and paste it in the address bar of your browser, then paste the following string:
directly behind the URL. Keep in mind that this part of the string should be lowercase. Press Enter in the address bar if you are ready. Your browser might ask you to give your credentials.
You will be presented with a file download, save it anywhere you like and open the file with a tool that can read JSON or use this service on the web.
The JSON content will look like this, in my case data from Seminars is disclosed:
Navision presents us with 2 objects: the metadata, after the ‘#’ we see the name of the web service the data is coming from. And the values, 3 records have been written in the file, each with 24 fields. The JSON format should be simple enough to parse in iOS, put in a dictionary and present the data to the user in a view on the device:-)
I will investigate this further and I am thinking of developing a wrapper (acting as a middleware web service between NAV and iOS client devices) that has sufficient rights to communicate with the Navision webservice and can return or receive data to/from the iOS platform without the need for Windows authentication but using pre-defined security tokens instead. If I succeed I will dedicate a couple of blogposts to it, to explain the techniques I used.
Note: instead on “json” you could also use “atom” to get an AtomPub document.