The Dynamics Web API is the new “preferred” method for interacting with Dynamics entities from web-based applications. If you are writing plugins and coded workflow activities, you would still use the pre-existing Dynamics SDK.
Getting familiar with the Web API is a bit of a leap of knowledge as you will dabble in Azure Authentication, JSON and Async implementations (if you’re not familiar with it).
Even though the API has been around since 2016, it’s disheartening to see there not being a singular location for Dynamics developers to bridge their current knowledge of the Dynamics SDK to the Web API.
Lots of trial and error still exists and this isn’t helped by the naming of the API either.
Also note, if you are hoping to get away with the now “vintage” Dynamics SDK, in new ASP.NET Web API Core projects, this API is unsupported due to its requirements for embedded Network Credentials.
The first thing you need to do in making your first connection is to authorize yourself in your tenant’s azure environment before doing anything. The MSDN walkthrough will take you through this in a straightforward way.
One caveat that I cannot stress enough is the redirect URL of your application. In the scenario, I am running through it is a basic console application so in this case, I don’t have a redirect URL to go to, but you need one. And when providing the initial connection from your application, you’ll need to include it for your connection to work.
For my connection, I used the following value.
The following is the heart of your initial connection and only requires references to the Microsoft.IdentityModel.Clients.ActiveDirectory and Newtonsoft.Json packages.
The tenant id is the URL to your Azure tenant while the dynamicCRMTenant is the url to your own Dynamics tenant. The key thing to note in your initial request to get “all your accounts” is that you are no longer querying for an entity by their schema name but rather the plural name – “accounts”.
So now, you have the simplest method of establishing your base connection.
3 Comments
You can post comments in this post.
[…] follow-up to my post on Getting Started with the Dynamics Web API – on a recent project, I was building a custom hosted control in the USD that leveraged the […]
Unified Service Desk and the Dynamics Web API – Forgotten Coder 3 years ago
[…] blogged about connection setup with the Dynamics Web API over the last little while – Getting it Setup and how to use with the […]
ASP.NET Web API Usage with Dynamics Web Api – Forgotten Coder 3 years ago
[…] how to setup a connection, the query can be as simple as […]
Accessing MetaData with the Dynamics Web Api | 365Concepts 2 years ago
Post A Reply