Skip to main content

Notifications

Customer experience | Sales, Customer Insights,...
Suggested answer

How to create a custom API. How can I expose an URL to the external system for custom Api.

Posted on by 218

How to create a custom API. How can I expose an URL to the external system for custom Api.

  • Suggested answer
    Bipin D365 Profile Picture
    Bipin D365 28,964 Super User 2024 Season 1 on at
    RE: How to create a custom API. How can I expose an URL to the external system for custom Api.

    Hi,

    You have multiple options to create custom API which will intreact with CRM indirectly.

    Microsoft Flow- You can create flow with trigger as HTTP trigger which will generate webhook URL that you can provide to external syste topost the data and as an action you create say lead record in CRM from flow.

    Azure function- Azure function is serverless computing service provided by microsoft which has HTTP trigger to generate webhook or posting URL. You can write custom c# code parse the data which is sent by external system and then create record in crm or perform any operation

    See below article on Azure function step by step by guide on how to create Lead in crm from external system.

    xrmdynamicscrm.wordpress.com/.../

    If found helpful, Please mark my answer verified.

  • cloflyMao Profile Picture
    cloflyMao 25,198 on at
    RE: How to create a custom API. How can I expose an URL to the external system for custom Api.

    Hi phanikumar,

    We need two tools for different purposes.

    1. Retrieve Dynamics entities: create an OData set from an entity list record in Portal Manament App, we can expose some records from a specific entity.

    https://www.inogic.com/blog/2019/03/retrieve-dynamics-365-crm-data-in-portal-by-calling-odata-using-javascript/ 

    2. Send data from your web application to Dynamics, and give callback response: We could deploy a flow with HTTP Request Trigger action and Response action in Power Automate.

    HTTP Request Trigger will generate an endpoint URL for us to process our request, then the trigger will send our data to Dynamics and give us a response.(optional)

    Due to there is no validation to access the URL, so we need some security steps to protect the endpoint.(send validation data together with user data.)

    https://flow.microsoft.com/en-us/blog/call-flow-restapi/

    Summary:

    Method 1 is static, our result is pre-defined in Dynamics, so we couldn't send any keyword to filter data.

    Method 2 is flexible, we could customize response body, thus it's possible to search records in Dynamics.

    e.g:

    The start HTTP Request trigger will receive my requested data as keyword to search related records in Dynamics.

    pastedimage1588669395790v1.png

    Set listed records as Body content of Response directly:

    pastedimage1588669503182v2.png

    Search whether there are contacts whose last name equal "Mao",

    we can see a XHR request will be sent, and get retrieved Dynamics data from callback data(Response Body).

    pastedimage1588669730021v3.png

    expand an item:

    pastedimage1588669915169v4.png

    Regards,

    Clofly 

  • phanikumar Profile Picture
    phanikumar 218 on at
    RE: How to create a custom API. How can I expose an URL to the external system for custom Api.

    Yes Clofly, I have to save or retieve(search) dynamics entities. How can I create and deploy Api to dynamics crm?

    Thanks

    Phani.

  • cloflyMao Profile Picture
    cloflyMao 25,198 on at
    RE: How to create a custom API. How can I expose an URL to the external system for custom Api.

    Hi phanikumar,

    Would your requirement be something likes below?

    Assume you have built a form, when user submits the form, submitted data will be inserted into Dynamics?

    Regards,

    Clofly

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!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans