Posted on 10/21/2017 3:03:00 PM by Levin, AricDynamics 365
When choosing to execute webapi functions, that are various methods that are available. The first option of course is to use the default GET, POST and PATCH required to Retrieve and Update data in CRM using the Web API.
The following shows how to call the WhoAmI WebApi function.
The first library is using the Web API library by ZA CRM Guy. The library is available for download from codeplex here. To call the library you add a reference to the library to your form where you want to call it from. The following sample shows how to call the webapi retrieve method:
This library is the simplest of all, and contains the basic functions for Create, Update, Retrieve, Retrieve Multiple and Delete. It is easy to use, but lacks a lot of the functionality of Web API. If you only need the basic function calls, it is a good option.
The library contains configuration parameters, so that it allows for impersonation, specifying the api version, paging size and more. This DynamicsWebApi library supports both Basic and Advanced calls to the web api. The available Basic calls include: create, update, upsert, deleteRecord, retrieve, retrieveMultiple, retrieveAll, count, countAll, executeFetchXml, executeFetchXmlAll, associate, disassociate, associateSingleValued, disassociateSingleValued, executeBoundFunction, executeUnboundFunction, executeBoundAction, executeUnboundAction. This allows for a comprehesive retrieval of most CRM data.
The library also includes Formatted Values and Lookup Properties to retrieve the related attribute information for Option Sets and Lookup Controls. The following sample shows how to call the WhoAmI request:
Finally, with the release of Microsoft Dynamics 365 version 9.0, the Xrm.WebApi class was added to the Xrm namespace. This class is comprehensive, and I would say that for the first release, contains most of the functionality that most users would need, and we know that this library will evolve as the versions of Dynamics 365 continue to progress. The sample below uses the basic WhoAmI request, that we showed in the previous samples.
Our conclusion is simple. If you need just basic functionality, and will never go past that, then SDKWebApi library might be sufficient. For anything more than that, we would recommend to use either the DynamicsWebApi by Aleksandr Rogov or the CRMWebApi tool by David Yack. Both are great tools and very extensive libraries.
If you are already on Dynamics 365 version 9 (July 2017 Update), we would recommend to start getting yourself familiarized with the Microsoft version of the library. It is extensive, yet simple and it will evolve as the product evolves.