Upgrade to v2024 EpicorRESTAPICore UnAuthorized

We upgraded our DEV and QA environments to v2024.2.4 and I am now getting Unauthorized when I try to make calls from my code.
We do not have issues in PROD running v2023
using EpicorRESTAPICore v2.2.0.2

using PostMan or the Resthelp seems to run fine.
Anyone else having issues with v2024 and the RestAPI?

if (EpicorRest.CreateBearerToken())
{
    MultiMap<string, string> iparams = new MultiMap<string, string>();
    iparams.Add("$select", "Company,MfgNum,MfgID,Name,Inactive");
    iparams.Add("$top", "10000");
    iparams.Add("$skip", $"{skipCount}");
    iparams.Add("$count", "false");
    var eri = await EpicorRest.BoGetAsync("Erp.BO.ManufacturerSvc", "Manufacturers", iparams);
    if (eri.ResponseStatus == System.Net.HttpStatusCode.OK)
    {

Do you use REST v1? Does your user have it enabled in for the user? table Ice.SysUserFile

1 Like

Can we see the rest of your code how are you setting up the RestCall

EpicorRest.AppPoolHost = DBManager.EpicorAppPoolHost;
EpicorRest.AppPoolInstance = DBManager.EpicorAppPoolInstance;
EpicorRest.UserName = "¿?¿?¿?¿?";
EpicorRest.Password = "¿?¿?¿?¿?¿?";
EpicorRest.Company = Company; 
EpicorRest.APIKey = APIKey; //out of date example: MlXImApzhuEI7AOfZzZZfzDDqeMMywPWZXK62ZTsZax4I
EpicorRest.APIVersion = EpicorRestVersion.V2; //Defaults to V2
EpicorRest.License = EpicorLicenseType.Default;
EpicorRest.IgnoreCertErrors = false;
EpicorRest.Timeout = epicorTimeoutMS; //ms (900*1000)
EpicorRest.MaxRequestLogLength = 1;
if (EpicorRest.CreateBearerToken())
{
    MultiMap<string, string> iparams = new MultiMap<string, string>();
    iparams.Add("$select", "Company,MfgNum,MfgID,Name,Inactive");
    iparams.Add("$top", "10000");
    iparams.Add("$skip", $"{skipCount}");
    iparams.Add("$count", "false");
    var eri = await EpicorRest.BoGetAsync("Erp.BO.ManufacturerSvc", "Manufacturers", iparams);
    if (eri.ResponseStatus == System.Net.HttpStatusCode.OK)
    {
        ManufacturerSvc r = JsonConvert.DeserializeObject<ManufacturerSvc>(eri.ResponseData.ToString());
        if (r?.Manufacturers?.Count > 0)
        {
            mfgs.AddRange(r.Manufacturers);
            if (r.Manufacturers.Count == topCount)
            {
                //need to go get more
                var moreMfgs = await GetManufacturers(frmWait, skipCount + topCount);
                if (moreMfgs?.Count > 0) mfgs.AddRange(moreMfgs);
            }
            return mfgs;
        }
    }
    else
    {
        ErrorDialog.Show($"GetManufacturers ResponseError", eri, "", new System.Diagnostics.StackTrace(true).ToString());
    }
}
1 Like

That’s trippy. Love it.

Monster Cookie GIF

1 Like

alt code 0191

just one that I always remember, lol

2 Likes

FYI: the fix here was to recycle the AppPool to fix the UnAuthorized calls.

1 Like