What is OData?
OData is a standard protocol for creating and consuming data. The purpose of OData is to provide a Representational State Transfer (REST)–based protocol for Create, Read, Update, and Delete (CRUD)–style operations. OData applies web technologies such as HTTP and JavaScript Object Notation (JSON) to provide access to information from various programs. OData provides the following benefits:
- It lets developers interact with data by using RESTful web services.
- It provides a simple and uniform way to share data in a discoverable fashion.
- It enables broad integration across products.
- It enables integration by using the HTTP protocol stack.
Exposing Entities of Dynamics Ax365 for OData
OData entities are based on the concept of an updatable view. When the IsPublic property for an updated view is set to TRUE, that view is exposed as a top-level OData entity.
- Open visual studio as an administrator in server on which dynamics 365 is deployed.
- Create new project of “Operation project” which is in installed template-> Dynamics 365 for operations-> Operation project.
3. After creating project select application explorer on the left side under toolbox. Their in data model->data entities. And select which entity you want to make public or you can simply search in top of application explorer in enter filter query box your entity name.
The selected red box is showing the package name(which is ApplicationSuite in my case) of the entity which we will use to make it for making custom package of user layer so that entity can be editable.
4. Create model. For this go on top in the toolbar. You will see dynamics 365->Model Management-> create Model.
5. Enter Model name, publisher, make sure layer is selected USR, version and description. And click next.
6. Select Existing Package and there you will see dropdown list of packages. There you will select the package name of which your entity is, which is (ApplicationSuite in my case). Then click next.
7. You can finish without creating new project because we have already made a operation project. If not, then you can select ‘create new project’.
8. Select your project from solution explorer and right click on it and select ‘Properties’. There you will see model so select your newly created model which was test model in my case. And press OK.
9. Again open application explorer, right click on entity and select add to project. This will add entity to current project and enable it for editing.
10. Double click on recently added entity in solution explorer. It will open entity for editing.
11. In its properties window in public you will see “Is Public” and change it to “Yes”.
Give Public Collection Name and public entity name to whatever you want to give which should be unique from other public entity names.