Call Epicor REST service from within BPM

Has anyone tried calling Epicor REST services from within a BPM? I have read a widget may be coming but in the mean time, I was attempting to call using C#. The code is valid and the issue appears to be related to calling back to the same server.

The use case is for updating a record in another company the user doesn’t otherwise have access to. I attempted to look for different ways to update the field in the remote company with a system user or otherwise but have not been successful so I thought I would turn to REST and do the update using a restricted user account.

The error produced when this code runs is:
The remote name could not be resolved: ‘’ (we are a DT SaaS customer - the actual URL appears to be correct)

I believe the issue is more related to trying to call back to the same server the code is running from and this may be a DNS configuration issue with the server. I tried localhost as well and get a different error (relating to the SSL certificate).

Has anyone else had any success doing something similar in a BPM?

  string serverURL = Session.AppServerURL.ToString();
  RESTBaseURL = serverURL + "/api/vi/";

  string RESTUserID="aaa";
  string RESTPW="bbb";
  var client = new System.Net.WebClient {Credentials = new System.Net.NetworkCredential(RESTUserID, RESTPW)};

    clientB.Headers["Content-Type"] = "application/json";
    data = "{\"CheckBox01\":\"True\",\"Number01\":\"" + CustNum + "\",\"ShortChar01\":\"" + CustID + "\"}";
    method = "PATCH";
    reply = client.UploadString(RESTBaseURL + "Erp.BO.CustomerSvc/Customers(xxx,277)", method, data);


Interesting… Does Session.AppServerURL resolve to the correct protocol (https)?

Yes it does

Is is possibly an issue with the URL? I’m only on 10.2.300 but I would need to use “/api/v1/” and appears your code has “api/vi/” for the endpoint

1 Like

You are absolutely right about that! It should be /api/v1/. Unfortunately, that is not ultimately the issue. Thanks for catching that though as it would have been an issue once I got the server name to resolve correctly.


Okay, sorry I’m at a loss then :frowning:

This should be /api/v1/

You can also use a BPM to modify data in another company without resorting to this method.

EDIT: I see now by looking at the complete thread you changed this. Have you tried using a basic REST call using postman or your browser?

Yes, the REST call itself works fine.

Hey Brad,

If you feel adventurous, I have an idea I’ve wanted to try out and this might be a good test case. Since we’re cloud users, a cloud solution might be in order.

Microsoft has a product called Azure Functions. This is part of their “Serverless” offerings. Basically, you would write a function that accepted the data you wanted to update in the other company. It would still use REST to post the result to your database. The function would run in the Central Region so the speed should be good. This would get around the issue if it was just a limit on self-referential invocation. The price? Essentially free for 10,000 calls/400GB per month. One million calls would be about $15 USD/month. Very affordable.

The question is: is the BPM having trouble making the call to itself or is there a block on all REST calls from Epicor Public Cloud in general? We might want to see if any REST calls can be made from the server-side. If not, this would be a real blow to Epicor Functions for Public Cloud users. Let me ping some of the Cloud folks to see if this a larger environmental issue and not your REST call at all.

Separately, @hasokeric did some work starting a new login within a BPM to update another company which you might find by searching.
Mark W.

Hi Mark -
I think that is a viable solution. I have been able to accomplish something similar (albeit not in the same datacenter) using Google scripts. So, I know we can call out from the server to other URLs, it appears to be an issue calling back to itself. I suspect this is a configuration issue on the server but have not yet discussed with the cloud team. I was just hoping there was something code wise I was missing. I’ll be interested to hear what you learn.


Hi @Brad_Weiss though this is certainly possible it is EXPENSIVE, you are already on the server (BPM) and going out to the web through the REST Facade -> back to the BO back to the server.
I recommend instead you try the TemporarySession creator.
Check out this post

1 Like

I had read that post and my takeaway was the user already had to have rights in the other company (possible but not preferred from a security perspective). Otherwise, if a service account was used (to perform this specific action) the session would take a relatively long time to create and still have the downside of having credentials hard coded into the BPM. REST calls seem to be rather quick so I was thinking this might be the less expensive solution but the network routing may become a deal breaker.

Please correct me if I misread the other post, some of it was a bit over my head!


Got it yes you are correct the user must have access to the other company, rest may be your best bet. In that case I would recommend you throw RestSharp into your external BPMs folder, this will make your life 1000 times easier.
How my guess tells me that the reason why you can’t hit is because DT is blocking internet WAN access on the server side (for good reason)
Could you try using LocalHost or

1 Like

I had tried localhost, got a different error about the certificate not being valid. We are able to get to other URLs in the wild, just not back to the server. I suspect what is needed is the local IP of the server but I also suspect it may not be static. I am going to ping SaaSOps and see if they can shed any light on a possible solution.

Regarding RestSharp, I think you are suggesting a folder on the server. Unfortunately, we don’t have access to this folder. Let me know if I misunderstood.


Just some ammo for your support call - I can do this just fine in DT using the fully qualified name - just like you have it. Sounds like something unique to your configuration or mine is wrong and allows it :slight_smile:

1 Like

Right sorry #SaaS :frowning:
The certificate issue you can bypass in code fairly easily. But obviously the right solution here is to get Epicor Support to fix your confg.

1 Like

One other potential advantage to the Azure Function solution is that the user would perceive it as faster since it’s essentially a deferred update. Control returns immediately while the update occurs. You will have to manage exceptions!!! Regular Intercompany Direct takes a couple of minutes usually so it actually might be faster.