CRUD Operations for an OData Entity in D365FO Using Postman

CRUD Operations for an OData Entity in D365FO Using Postman

In this blog, we will explore how to perform CRUD (Create, Read, Update, Delete) operations for an OData entity in Dynamics 365 Finance and Operations (D365FO) using Postman. OData (Open Data Protocol) is a REST-based protocol used for querying and updating data.

Refer to my earlier post to set up postman and now we will proceed to execute these operations using Entity.

This is not the entity name in FO, but ‘Public Collection Name’ in the properties referred in the entity.

Article content

(A). Create (POST)

To create a new record in the OData entity :

1. Use the HTTP method POST.

2. Set the URL to your entity endpoint, e.g.

https://<your-d365fo-url>/data/<entity-name>.        


Article content

In the above screenshot, the status ‘210’ denotes Success and you can see a new record created in D365 FO.

(B). Read (GET)

To retrieve data from the OData entity :

1. Use the HTTP method GET.

2. Set the URL to the entity endpoint, e.g.,

https://<your-d365fo-url>/data/<entity-name>.        
Article content

3. Update (PATCH)

To update an existing record in the OData entity:

1. Use the HTTP method PATCH.

2. Set the URL to the specific record, e.g.,

 https://<your-d365fo-url>/data/<entity-name>(PrimaryKey).        
Article content

The request will have the entity key fields defined in Data Entity. There will be no reponse received ,but the status code will be ‘204’.

4. Delete (DELETE)

To delete a record from the OData entity:

1. Use the HTTP method DELETE.

2. Set the URL to the specific record, e.g.,

https://<your-d365fo-url>/data/<entity-name>(PrimaryKey).        
Article content

The entity keys will be passed in the request parameters. There will be no response except the status as ‘204’ which states the process is completed. If you check in FO, the record would have got deleted.

CONCLUSION

  • Always test API calls in a non-production environment first.
  • Use appropriate permissions to avoid unauthorized changes.
  • Use logging mechanisms to track requests and responses.

Ali Raza Zaidi

D365 Finance and Operational Technical Solution Architect

7mo

Only issue with odata is bluk insertion, second issue is header and child in same call for example sales order and sales line table insertion in single call.

To view or add a comment, sign in

Others also viewed

Explore topics