Wednesday, 4 July 2018

Exposing data entities for OData

Today I will be discussing about to how to expose data entities for OData. First lets talk about what is Odata?

It is a standard protocol for creating and consuming data. Its main purpose is to provide a protocol that is based on Representational State Transfer (REST) for create, read, update and delete (CRUD) operations. It applies web technologies such as HTTP and JSON to provide access to information from various programs.
It provides following benefits.

  • Let developers interact with data by using RESTFUL web services.
  • Provides a simple and uniform way to share data in a discover able manner.
  • Enables broad integration across products.
  • Enables integration by using the HTTP protocol stack.
Lets say we have a scenerio in which we are integrating ax with another party for purhcase orders. All PO's will be created in their system and we need to have them in AX. For this purpose we will be creating a data entity which will be exposed publicly for Odata.

1. Open Visual studio as a administrator.
2. I have created DemoModel for it. Below is its screen shot and remember it is new package referring to basic models like ApplicationSuite, Application Foundation etc.

  
















3. Create a new project first. By clicking on File -> New -> Project -> Select unified operations from Dynamics 365 node.















4. Create a data entity by right clicking on your project. Add new item -> Data model -> Data entity















5. Select PurchTable in Primary Datasource option.
Note : Public collection name will be publicly used for exposing and i have selected limited number of fields from purchtable. You may select it as per your requirements.




















6. New entity has been created along will additional required artifacts 
























7. Note all properties and remember to change data entities name label as per your requirements. Because there are chances you might encounter issues while building project since data entity name might be be used by existing entities. .











8. Build and sync project.
9. For verification you may use this URL on IE and it will generate  json file. 




Final result






Note : Below mentioned URL will be used for checking any exposed data entity.  Just you need to add your data entity public collection name.
https://usnconeboxax1aos.cloud.onebox.dynamics.com/data/Data entity public collection name

No comments:

Post a Comment

Note: only a member of this blog may post a comment.

Custom Business events Part 3 - (Activate custom business event) in D365 F&O

 In this blog we will discuss about the steps to activate a custom business in D365 F&O. As we know that business event catalog does not...