Blog

CRM Web API -Prepare for Upgrades

A Web API was introduced for CRM 2016 Online and On-Prem and will eventually replace the existing Organization.svc, OrganizationData.svc and Discovery.svc endpoints. Developers use the API to communicate with the CRM data via their custom code, external applications and services. Why has Microsoft introduced this new API?  Microsoft’s public reason was to “make it easier to create applications across a wide variety of platforms, devices, and programming languages.”  This API is REST-like and is expected to eventually provide complete parity with the existing Organization.svc endpoint that we use today. They have only explicitly stated that the OrganizationData.svc has been deprecated thus far in CRM 2016, but it’s a good idea to start planning your upgrades.

  • Common components you will need to plan for in your upgrade:
  • JavaScript that utilizes the existing OrganizationData.svc, such as the SDK.REST.js. The following tools were developed by the Microsoft community and are available to assist you with writing your JS against the Web API:  https://msdn.microsoft.com/library/gg334279(v=crm.7).aspx#BKMK_ThirdPartyTools
  • CRM Helper pages, Windows Services, Web Services that utilize the existing Organization.svc:
  • The majority of your code will need to be re-written. This is very different than past code upgrades for CRM, so please be sure your team is prepared. Some examples of how the code will look can be found here: https://msdn.microsoft.com/en-us/library/mt607901.aspx
  • Authentication will also change: You must use OAuth 2.0 for CRM online and CRM IFD. Per Microsoft, you need to “register your app with the Active Directory for your organization. Then you can use the Azure Active Directory Authentication Library (ADAL) to manage OAuth 2.0 authentication with the CRM web service identity provider” An example of how your code will look can be found here: https://msdn.microsoft.com/en-us/library/gg327838.aspx
  • For this initial release of CRM 2016, Microsoft still has several issues to be resolved before complete parity is achieved with the existing Organization.svc endpoint. This may not affect most scenarios, but be sure to check out their list when planning your upgrades: https://msdn.microsoft.com/en-us/library/mt628816.aspx
  • Other applications (such as Scribe) or the MSCRM plugin registration tool that utilize the Discovery.svc.  Aside from updated versions that those ISVs and MS will need to provide for you, be sure to point those to the new Discovery endpoint in 2016: https://disco.crm.dynamics.com/api/discovery/v8.0/

This may seem like a huge undertaking for any organization with a substantial amount of custom code, so I’d like to point out some of the positives for using this Web API as it is a pretty exciting step forward:

  • Code will be easier to manage, utilizing modern technologies that most developers are already familiar with such as JSON, HTTP requests. It does not require reference to the dlls that we often have to include in our CRM solutions. It also does not require knowledge in the .NET framework and languages associated with it (C#, VB, etc.).  You absolutely can continue to use those languages, but you can also choose to code from other supported languages such as Java, Python, etc.

;

  • Not all code needs to be re-written. Some code, such as our fetchxml strings(see example: https://msdn.microsoft.com/en-us/library/mt607533.aspx#bkmk_useFetchXML ) and any logic outside of the CRM API calls, can still be used.
  • Custom workflows should not be upgraded at this time.  Per MS, “you’ll continue to use the classes defined in the SDK assemblies to use the organization service”

Stay tuned as I dive further into the Web API. Beringer Associates is always here to provide expert knowledge in topics like these. Please contact us with any questions you may have.