The REST calls in my WinForms app to an Epicor Function work great until I make the call for an Epicor company that is NOT the company where the Function was created. For example, the Epicor Function is created in CompanyA but I’m trying to get an order number that is in CompanyB.
When I debug the below code the RequestURI looks like this
{https://Server/Instance/api/V2/efx/staging/CompanyB/SalesOrderSvc/GetByID}
The ResponseStatus is NotFound, ResponseData is null and ResponseBody is “”.
Is there a way to get data from multiple companies when calling Functions outside of Epicor?
The function in CompanyA:
The REST call to the function:
public static async Task<SalesOrderFunction> GetByID(int orderNumber, string company)
{
try
{
CallContextHeader callContext = new CallContextHeader();
dynamic postData = new
{
iOrderNum = orderNumber
};
var response = await EpicorRest.EfxPostAsync("SalesOrderSvc", "GetByID", postData, callContext, true);
if (response.IsErrorResponse)
{
TraceLog.Write(string.Format("Failed to GetByID: {0}", response.ResponseError));
}
return JsonConvert.DeserializeObject<SalesOrderFunction>(response.Response.Content.Trim().ToString());
}
catch (Exception ex)
{
TraceLog.Write(string.Format("Failed to GetByID: {0}", ex.ToString()));
throw new Exception(ex.Message);
}
}
Any suggestions are appreciated.
Kelly