Getting Started with the Dynamics Web API

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.


You can post comments in this post.

Post A Reply

%d bloggers like this: