web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :

Why Dynamics 365 WEB API

gdas Profile Picture gdas 50,091 Moderator

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

Organization Service – uses WCF to SOAP endpoint
Web API – uses WCF to Rest Endpoint

Implementation

Organization Service -Implements IorganizationService Interface
Web API – Implements OData V4.

Request/Response

Organization Service -XML
Web API -JSON, TEXT,XML

Connection

Organization Service -Required Assembly to authenticate Dynamics CRM
Web API -No Assembly required to connect Dynamics CRM.

Supported Action

Organization Service- Assign Records , Retrieve Metadata, Execute Message and Anything
Web API –  Create, Retrieve, Update, Delete , Associate, Diassociate, Assign, Retrieve metadata

Maximum No Records

Organization Service -5000
Web API – 5000

Differences Organization Data Service and Web API

Format

Organization Data Service – uses WCF to Rest Endpoint
Web API – uses WCF to Rest Endpoint

Implementation

Organization Data Service -Implements OData V2 standard
Web API – Implements OData V4.

Request/Response

Organization Data Service  -JSON, ATOM
Web API -JSON, TEXT,XML

Connection

Organization  Data Service -No Assembly required to connect Dynamics CRM.
Web API -No Assembly required to connect Dynamics CRM.

 

Supported Action

Organization Data Service- Create, Retrieve, Update, Delete , Associate, Disassociate
Web API –  Create, Retrieve, Update, Delete , Associate, Diassociate, Assign, Retrieve metadata

Maximum No Records

Organization Data Service -50
Web API – 5000

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.

crmrest1

 

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 .

crmrest2

 

crmrest3

Hope this helps

Comments

*This post is locked for comments