web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Need to Call Restful API from Plugin/Workflow Activity (On-Premise) -- Sandbox

(0) ShareShare
ReportReport
Posted on by 120

Hello All,

I have a On-Premise setup of Microsoft Dynamics 365.

I am able to call restful API from plugin/workflow activity when it is not registered under sandbox mode.

The moment, I register it under sandbox, I am getting an error.

I have done following things for the same

  • Restful API is exposed over https
  • While calling the API from plugin/workflow activity, I am using web address that requires DNS name resolution
  • Anonymous authentication is supported by Restful API.

I have tried all possible ways. Can you suggest me any other solution. Any workaround at least?

Any help would be much appreciated !!!

Thanks in advance.

Regards,

Sachin

I have the same question (0)
  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Sachin,

    There are few reasons why your code doesn't work. What is the port it is available on? If it's not 443 - you should enable it. Check this post - docs.microsoft.com/.../gg334752(v=crm.8)

    If the port is 443 you should check Firewall Settings on your server.

  • SachinLade Profile Picture
    120 on at

    Hello Andrew,

    Thank you for the quick response. The Restful API is available on ports 443. I can call this api using normal standard .Net Console application.

    Below is the sample code which I am writing in the Plugin

    ServicePointManager.ServerCertificateValidationCallback = (sender, cert, chain, sslPolicyErrors) => true;
    var webClient = new WebClient();
    webClient.Headers[HttpRequestHeader.ContentType] = "application/json";
    var serviceUrl = "">www.*******.com/.../";

    // upload the data using Post mehtod
    string response = webClient.DownloadString(serviceUrl);
    return response;

    Can you let me know about where I am making the mistake. Also the plugin is running in Sandbox mode.

    Regards,

    Sachin

  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Sachin,

    As I mentioned you should check Firewall Settings on your server. Alternatively try to use "No Isolation" when you register the plugin because you're using On-Prem so you have this option there.

  • SachinLade Profile Picture
    120 on at

    Hello Andrew,

    Yes with "No Isolation" mode it works fine. But I want to make it work in Sandbox mode.

    Regards,

    Sachin

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Sachin,

    What error do you get when you run your plugin in isolation?

  • Suggested answer
    sdfasdf Profile Picture
    842 on at

    You may want to try removing the following line of code:

    ServicePointManager.ServerCertificateValidationCallback = (sender, cert, chain, sslPolicyErrors) => true;

    Use of certificates is not supported in sandbox service. Additionally, you might prefer using the HttpClient class for consuming RESTful APIs.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 70 Super User 2025 Season 2

#2
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 43 Most Valuable Professional

#3
Daniyal Khaleel Profile Picture

Daniyal Khaleel 32 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans