Epicor Rest Helper (Nuget) Updated V2

We need a call stack or something to see what the error is.

1 Like

Hi Jose

Thanks for the quick response.

I hope this is what you are looking for. If not, please advise.

System.MissingMethodException
HResult=0x80131513
Message=Method not found: 'Void RestSharp.RestClient…ctor(RestSharp.RestClientOptions, System.Action1<System.Net.Http.Headers.HttpRequestHeaders>)'. Source=EpicorRestAPI StackTrace: at EpicorRestAPI.EpicorRest.HttpJson(Method iMethodType, String iBaseMethodURl, String iFormattedParams, Object iJsonData, CallContextHeader iCallContext, Dictionary2 requestHeaders)
at EpicorRestAPI.EpicorRest.BaqGet(String iBaqID, MultiMap`2 iParameters, CallContextHeader iCallContext)
at Chem_Uploader.frmMain.cmdUpload_Click(Object sender, EventArgs e) in C:\Users\pheffer\OneDrive - Signature Aluminum Canada Inc\Documents\source\repos\Chem Uploader\Chem Uploader\frmMain.cs:line 639

This exception was originally thrown at this call stack:
[External Code]
Chem_Uploader.frmMain.cmdUpload_Click(object, System.EventArgs) in frmMain.cs

Chemical Properties Uploader.exe!Chem_Uploader.frmMain.cmdUpload_Click(object sender, System.EventArgs e) Line 1128
[External Code]
Chemical Properties Uploader.exe!Chem_Uploader.Program.Main() Line 21

You need restSharp 108.0.1.0 I believe try that.

1 Like

I have downgraded the versions so now running RestSharp 108.0.1 but also had to downgrade to EpicorRestAPI 2.04 in order to not error. Now no longer getting any errors but application will not respond.

1 Like

Is this .NET 6? .NET 4.8?

1 Like

Its .Net 4.8

1 Like

I just tried it on a new .net 4.8 project zero issues. Remove EpicorRest API nuget and RestSharp. Then Install EpicorRest API by itself it should bring the right dependency wiht it.

1 Like

Here’s mine example, works just fine

Ok. Will give that another try in that sequence.

Please confirm what version of EpicorRestAPI I should be using. I have uninstalled and reinstalled a few times while troubleshooting this under various versions.

Thanks again and sorry for any noob questions. :slight_smile:

1 Like

The latest version should be what you are using 2.2.0.2

1 Like

That was it. Uninstalling EpicorRestAPI and RestSharp, then saving project. Closing and reopening then installing only EpicorRestAPI and allowing it to install dependencies seemed to correct it.

I swear I did that before but it must be the sequence of actions that made the difference.

Thanks for your help!

1 Like

I am, trying to use the EpicorRestAPI in a project to do some batch rescheduling via the API versus doing a DMT. I am using version 2.2.0.2

I am using the ‘/{currentCompany}/Erp.BO.JobEntrySvc/JobScheduling’ Custom method, and it runs, but it does not actually reschedule the Job. Doing the DMT version of the scheduling does work , and when I test the API call on the swagger help page, it also does not really work, so I am wondering if that functionality is broken in the REST system. I am running in 10.2.700.26

Her is the code I am trying:

var postData = new
{
    ipJobNum = "0543847",
    ipReturn = true,
    ipStartAssemblySeq = 0,
    ipCurrentAssemblySeq = 0,
    ipCompleteTree = true
};

var response = EpicorRest.BoPost("Erp.BO.JobEntrySvc", "JobScheduling", postData, callContext);

return response;

The response object comes back with a 200 OK, but it is all empty data

Response = "StatusCode: OK, Content-Type: application/json, Content-Length: 491)"

"{\"returnObj\":{\"JobHead\":[],\"JobHeadAttch\":[],\"JobAsmbl\":[],\"JobAsmblAttch\":[],\"JobAsmblInsp\":[],\"JobMtl\":[],\"JobMtlAttch\":[],\"JobMtlInsp\":[],\"JobMtlRefDes\":[],\"JobMtlRestriction\":[],\"JobMtlRestrictSubst\":[],\"JobOper\":[],\"JobOperAttch\":[],\"JobOperInsp\":[],\"JobOperMachParam\":[],\"JobOpDtl\":[],\"JobResources\":[],\"JobOperRestriction\":[],\"JobOperRestrictSubst\":[],\"JobAsmblRestriction\":[],\"JobAsmblRestrictSubst\":[],\"JobAsmRefDes\":[],\"JobAudit\":[],\"JobPart\":[],\"JobProd\":[],\"ExtensionTables\":[]}}"

Suggest creating a separate topic, might not get seen here.

Like Steve said this isn’t an issue with the library this is an issue with how you are using the BO

I suspect it needs a before image or something else

1 Like

Hello,

First thanks for this excellent work, it has been a tremendous help for our new Epicor implementation and comprehension.

I have a bug that I cannot explain. The json responsebody of an API request contains much more data that expected, empty datasets that bloats the result.

The request is Erp.BO.JobEntrySvc.GetNewJobOper. When calling it like below the data.responsebody contains 103 entries in the jobhead table.

When I do the same request with the EPICOR REST API helper I do have the expected result with just one entry in the JobHead table.

Other methods such as Erp.BO.JobEntrySvc.GetNewJobMtl are implemented the same way and works fine.

Any idea what could cause this ?

Thanks again for your work!

Request code :

var inputParameters = new
{
    ds,
    jobNum,
    assemblySeq
};

CallContextHeader callContext = new CallContextHeader();

EpicorResponseObject data = await EpicorRest.BoPostAsync(
    "Erp.BO.JobEntrySvc",
    $"GetNewJobOper",
    inputParameters,
    callContext);

if (data.IsErrorResponse) throw new APIRequestException(data.ResponseError, data.Response.ErrorException);

try
{
    var Root = JsonSerializer.Deserialize(data.ResponseBody, typeof(RootParams)) as RootParams;
    var updatedDs = Root.parameters.ds;
    return updatedDs;
}
catch (Exception ex)
{
    throw new APIResponseException(ex.Message, ex);
}

Does your input DS contain JobHead data?

Yes It does, It contains job head, job asmbl and job part. I usually get this dataset by calling JobEntry.GetByJobNum

Did you figure this out? Can you give us a sample of your Request I would imagine if you are getting too many responses is because Epicor isn’t seeing that you are trying to get for a Single job.

Yes i did found out, I was confused about method where you have to send out two dataset (original and the modified one) and accidentlly did this while creating new object (rowmod=“A”).

I ended up using more UpdateExt for little modifications and keeping different workflows for creating objects and modifying it, which works fine.

1 Like

Hi, I am using EpicorRESTAPICore v2.2.0.2
and it looks like it is using an outdated version of RestSharp (108.0.3) and VisualStudio lists that version of RestSharp as vulnerable and needs to be updated to the latest (112.0.0)
but when I manually update this, it fails due to some internal calls that EpicorRESTAPICore makes to RestSharp. Do you have plans on updating this soon?