Skip to main content

Notifications

Announcements

No record found.

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 Microsoft Employee

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 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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,735 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,466 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans