Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Dynamics Web API access to clients OR expose own API in Azure to fetch records from Dynamics CRM??

(0) ShareShare
ReportReport
Posted on by

Hi community!

I recently came up with the requirement of allowing some clients (I am supporting Dynamics 365 in my organization) to get some record data from my Dynamics 365 platform. They are currently using OData to fetch records from Dynamics, the cool thing is that any client no matter the type of program they are running can access the data by using OData queries. The problem is they can access more data than I wish (can be resolved by assigning security roles) and most importantly they are heavily dependent on changes made to entities and attributes. 

Yes, meaning today they could be fetching records from the Contact entity, let's say specifically grabbing FirstNameLastNameSocialSecurityNumber and PhoneNumber attributes. If in the near future I decided to stop supporting the SocialSecurityNumber field and created a new one called "SocialSecurityNumber_Tokenized", I would have to let know my clients to modify their programs to now fetch the correct field. This implies changes to every client program consuming these records, which means code changes on their end, re-testing, developers getting mad, etc.. So this is when I came up with the idea of having an API in Azure which my clients can hit and obtain the records. Instead of having them write these ODataqueries, I would build an API that fetches these records. They would only have to hit the following method via HTTPS (sample) "fakeApi/api/myApi/GetContactData" which will return the records with attributes I choose to return in a nice JSON format response. 

I see many benefits on implementing this solution, overall the most important one would be that any changes in my entities (database) would not affect my clients since any changes would be updated as well in my API, loosely couple integration will be achieved :). 

What are your thoughts?

Change is the only constant...

*This post is locked for comments

  • Suggested answer
    Aric Levin Profile Picture
    Aric Levin 30,188 Moderator on at
    RE: Dynamics Web API access to clients OR expose own API in Azure to fetch records from Dynamics CRM??

    Hi Emilio,

    Not sure if you have previously developed an API in Azure, but the process is pretty straight forward and not too complex, especially if you are doing this with Visual Studio, which will build the project and publish it to Azure easily.

    The only thing you will be left to do is calling the CRM WebAPIs from your Azure API.

    We have done a similar implementation for SharePoint, where the consumers of the Azure API could be CRM or other applications, so I don't foresee any downsides to this. Of course with changes to CRM, you would have to modify the Azure API as well, but that would have to happen regardless which approach you would take.

    Hope this helps.

  • Suggested answer
    Nuno Profile Picture
    Nuno 2,005 on at
    RE: Dynamics Web API access to clients OR expose own API in Azure to fetch records from Dynamics CRM??

    Hi Emilio,

     

    Beyond developing an API for fetching records (which is really a good solution) you can also achieve a loosely couple integration using crm actions. Instead of querying directly the contact record, it would be executed the crm action via Web API.

    https://msdn.microsoft.com/en-us/library/mt607600.aspx#bkmk_customActions

    The action:

    So, let's consider you have an output attribute named xpto and in the future you want the change the value provided in this attribute, you only have to update the action on CRM.

    If you follow the strategy of developing an API for fetching record, you also would not need to change the client code you consumes your API, but it would be required to update your API, and updating an action in CRM is perhaps simpler than updating an API.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,432 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans