Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

How to call secured external rest API from CRM Dynamics 365 online

(0) ShareShare
ReportReport
Posted on by 233

Hi,

I have requirement to call external rest API(which is not exposed on internet https) which is deployed on our network.

I need to pass crm form input data (json format) to this external service and it will return response in json format.

The response should be show in crm ideally html grid and when click on selected record the data should be populate on crm form fields.

Currently using crm 365 online 8.2.2 version.

What will be the best approach to achieve this functionality.

*This post is locked for comments

  • Naveen K Profile Picture
    233 on at
    RE: How to call secured external rest API from CRM Dynamics 365 online

    Hi All,

    Thanks for your reply.

    Mahender,

    The external API serves for other systems as well and it will not be possible to deploy on Azure.

    If this is the case how to achieve this functionality.

    Please let me know if anybody came across this kind of requirement.

    Thanks.

    Yadav

  • Suggested answer
    Mahendar Pal Profile Picture
    45,095 on at
    RE: How to call secured external rest API from CRM Dynamics 365 online

    Hi Naveen,

    You can't communicate Dynamics CRM to your private api hosted on your network because there should be somehow it should be accessible to CRM, only option is the have your api hosted on the Azure and you can try to communicate as suggested by Aric.

    You can start looking here: docs.microsoft.com/.../api-management-using-with-internal-vnet

  • Suggested answer
    gdas Profile Picture
    50,091 Moderator on at
    RE: How to call secured external rest API from CRM Dynamics 365 online

    Hi Naveen,

    Aric already given an example of calling rest api.Here is another reference, please have a look.

    community.dynamics.com/.../786117

    var ajax = new XMLHttpRequest();

    var url = 'maps.googleapis.com/.../json{' + searchString + '}&types=address&language=en&crossDomain=true&key=[ourkey]';

    ajax.open("GET", url, true);

    ajax.onload = function () {

       var response = JSON.parse(ajax.responseText);

       if (!response || !response.results || !response.results[0]) {

           alert(response.error.message);

           return;

       }  

    };

    ajax.send();

  • Suggested answer
    Aric Levin - MVP Profile Picture
    30,188 Moderator on at
    RE: How to call secured external rest API from CRM Dynamics 365 online

    Hi Naveen,

    I have done this with JavaScript/jQuery and an Azure Api.

    You would call it the following way (you can manipulate the below as needed):

    var _retrieveCategories = function () {

    var urlPath = "xyz.azurewebsites.net/.../GetCategories";

    $.ajax({

    url: urlPath,

    type: "GET",

    dataType: "json",

    async: false,

    crossDomain: true,

    success: function (data, textStatus, xhr) {

              return JSHelper.toJson(data);

    },

    error: function () {

    }

    })

    .done(function (data, status, jqxhr) {

    });

    }

    To pass authentication information you can set the authorization property on the above code, or you can also set CORS and set it to the Dynamics Url, so that it is only accessible from there.

    Hope this helps.

  • Naveen K Profile Picture
    233 on at
    RE: How to call secured external rest API from CRM Dynamics 365 online

    Hi Goutam,

    The external service hosted on secured https and it should't be public.

    In this case how we can communicate to this rest api from crm 365 online?

    Any work around?

    Thanks,

    Yadav

  • Suggested answer
    gdas Profile Picture
    50,091 Moderator on at
    RE: How to call secured external rest API from CRM Dynamics 365 online

    Hi Naveen,

    Seems this is not possible  , you need to host your services in the WEB in addition you service should be "https" . You can not  pass information from secure url  content to unsecure url . You will get below error.

    httpblock1.png

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics CRM (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 83 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 52

#3
Victor Onyebuchi Profile Picture

Victor Onyebuchi 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans