Monday, June 16, 2014

NAV 2013 & NAV 2013 R2 - How to - Use OData to Return or Obtain a Service Metadata

Hi all,

In Previous post related to ODATA we saw how to publish and consume a ODATA Web Services from NAV 2013 & 2013 R2.

Below are some link Related to Old Articles Published for ODATA -

NAV RTC - Introduction to Web Services.

Introduction of ODATA Services In NAV 2013.

What is the ODATA?

Max. Page Size in ODATA Parameter.

Consuming Output of ODATA - Part 1


Today we will see a small but important point about ODATA i.e How we can see Metadata of Odata Web Service we have exposed.



The Example shown below is from NAV 2013 R2 and using a Page web Service. The Steps remain same for Query Web Services and in NAV 2013.


Create a Page Web Services for say Customer Card Page 21. 
*How to Create a Page Web Service.

For Checking the Metadata of the Exposed OData web Service, Open Internet Explorer and type in URL in below format -

http://<Server>:<WebServicePort>/<ServerInstance>/OData/$metadata

If standard installation and Server is running on Local Computer use -

http://localhost:7048/DynamicsNAV71/OData/$metadata

The keyword $metadata returns the Metadata of the exposed Odata Web Services in EDM Format as shown below.



If you see it there are some key points to Note -

Microsoft Dynamics NAV field names are mapped to EDMX property names by replacing spaces with underscores.

Primary key fields in tables are automatically defined as properties in the service metadata document even if they are not exposed on a page as controls.

I needed it and thought of sharing so that anyone else can use it, if required.

Regards,
Saurav Dhyani
saurav-nav.blogspot.com

No comments:

Post a Comment