Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

How to call CRM API from outside of CRM?

Posted on by Microsoft Employee

I have a tenant and I want to access the api below from outside of the CRM:

MyTenantUrl/api/data/v8.2/accounts

is it possible to access the above api from outside of the CRM like from other application?

Thanks in advanced.

*This post is locked for comments

  • RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: How to call CRM API from outside of CRM?

    Hi Shahriat,

    If you have got the answer to your questions then please close this thread by marking the suggestion as verified.

  • Suggested answer
    Shidin Haridas Profile Picture
    Shidin Haridas 3,497 on at
    RE: How to call CRM API from outside of CRM?

    Shahriat,

    Simple answer to your question: YES! CRM can be integrated and accessed from any application.

    Trickier / tougher question is on how to do it as with regards to the authentication.

    As seen from the posts above, there is no 1 single way to achieve it.

    As a thumb-rule,

    1. 1. If its a .NET application, then use the CRM SDK and use the ToolingConnector DLL to connect to Dynamics365.
      Similar to a console application.
      Again, you can maybe create a WCF service / azure function / wrapper class which talks to Dynamics365 and gives you what you need.

    2. If you need to consume the API through JavaScript (and outside a web-resource), then the recommended approach is to use the ADAL.js
      Documentation here: https://docs.microsoft.com/en-us/previous-versions/dynamicscrm-2016/developers-guide/mt595797(v=crm.8)
      You would need to register your app on Azure AD (for authentication to work)
      Or your JS can call a web-service and the web-service is a piece of .NET code which connects to Dynamics 365 as mentioned in step 1.

    Good luck!

    If my answer helps you, please mark it as verified.

     

  • Verified answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to call CRM API from outside of CRM?

    Hi Ravi, Could you please share an example how I can do the same as you are saying like "can create your own service which connects to CRM using credentials and then you can call/consume that service using JavaScript". It will help me a lot. Thanks for your such a valuable response to me.

  • Suggested answer
    gdas Profile Picture
    gdas 50,085 on at
    RE: How to call CRM API from outside of CRM?

    Hi,

    Without app authentication you can not call  Web API from  JavaScript if you are calling WebAPI from outside CRM .

  • Suggested answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: How to call CRM API from outside of CRM?

    Yes, dlls works for both on premise & online.

    Yes, you can create your own service which connects to CRM using credentials and then you can call/consume that service using JavaScript.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to call CRM API from outside of CRM?

    With CRM SDk assemblies will  it work on-premise or online? If it works online then can I create web api on the same application and call that api from js client instead of app registration?

  • Suggested answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: How to call CRM API from outside of CRM?

    1) If you want to query CRM using JavaScript web api, you need to register your app for authentication.

    2) If you are using .net application/ C# then you can use CRM SDk assemblies for which you can specify the credentials within the application.

    So to summaries, it depends upon what kind of application you are developing. If it is client based using javascript then you need to register app otherwise you can use CRM SDK dll's.

    Hope this helps.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to call CRM API from outside of CRM?

    Hi Goutam, I don't want user have interaction with login for my .net application. User will only use js application with his login there but he will not know how the records are coming from.  In your online example it is asking for azure registration. So I am seeking a solution which is state forward for my needs.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to call CRM API from outside of CRM?

    I am using online one.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans