Why Dynamics 365 WEB API
In this blog I want to describe what are the service Microsoft provide to working with Dynamics 365. We may still use in most of our projects SDK.REST or XRMServiceToolkit, $Ajax post . Its time to replace those code and use Web API.
Agenda
- Key Points Organization Service.
- Key Points Organization Data Service.
- Key points Web API.
- Differences between Organization Data Service and Web API.
- Differences between Organization Service and Web API
- Sample code of WEB API and start using WEB API
Organization Service
- Implement IOrganization Service Interface
- Also known as SOAP endpoint means request/response are SOAP format.
- Primary used for retrieve data and metadata from MSCRM Organization.
- Return maximum 5000 record for single request.
- Required Additional Assembly to get the reference of IOrganization Service.
- Need to write code to authenticate MS Dynamics CRM.
- All Client does not supported Organization Service.
- Might be gradually deprecated in Dynamics 365 future release.
Deprecated Organization Data Service
- Implements OData Version 2.
- Use WCF Rest Endpoint.
- Access Entity Data using URL
- Support request and response JSON and ATOM
- No need to write code for Authentication.
- Required third party helper file in JavaScript (XRMServicetoolkit) or SDKRest.
- Easy to consume service from JavaScript.
- Return maximum 50 record in a single request.
- Primary used for Create, Retrieve, Update , Delete , Associate , Disassociate.
- We can not retrieve metadata of the entity using Organization Data Service.
- Deprecated with Dynamics 365 in new version of MS Dynamics 365.
Using Web API
- Implements OData Version 4
- Use WCF Rest Endpoint.
- Access entity data using URL.
- Support request and response JSON ,TEXT, XML
- No need to write code for Authentication.
- Easy to consume service from JavaScript.
- Return maximum 5000 record in a single request.
- Primary used for Create, Retrieve, Update , Delete , Associate , Disassociate, retrieve metadata of the entity.
Differences Web API and Organization Service
Format
Implementation
Request/Response
Connection
Supported Action
Maximum No Records
Differences Organization Data Service and Web API
Format
Implementation
Request/Response
Connection
Supported Action
Maximum No Records
OData V2 in Dynamics CRM
Dynamics CRM Client URL +” /XRMServices/2011/OrganizationData.svc” –
Need to Add Assembly reference or JavaScript utility.
Additional Suffix ”Set” with Entity Name (example – ContactSet)
OData V4 in Dynamics 365/2016
Dynamics CRM Client URL +” /api/data/v8.2″
Do not need any Assembly reference of Javascript.
Only Suffix ”s” with Entity Name (example – Contacts)
Create WEB API request using CRMRESTBuilder
Its easy to create rest API using CRMRestBuilder tool , as sometimes its hard to write the code manually , so I would suggest download the CRMRestBuilder from here below url-
https://github.com/jlattimer/CRMRESTBuilder
After download the CRMRestBuilder solution you need import the solution in your CRM instance . You will find the button in top ribbon of Customization/solution Area in CRM instance.

Click on the button and it will redirect to you another window where you can choose your entity, attributes , filter ,Order by as well as the type of request . It will give you the generate code . Here is sample screenshot .


Hope this helps

Like
Report
*This post is locked for comments