Epicor Rest Helper (Nuget) Updated V2

Many Thanks. Weird thing was a straight copy produced errors. If I typed it out, no errors.

How would one pass in just one portion of the dataset for an UpdateExt on JobEntry? Do I need the entire payload as executed in swagger or Postman? I would assume minimum is to remove quotes from ds, JobHead, Company etcā€¦ Still need continueProcessingOnError

{
      "ds": {
          "JobHead": [
              {
                  "Company": "****",
                  "JobEngineered": false,
                  "JobReleased": false,
                  "JobNum": "239825",
                  "UD_SysRevID": "&&&&"
              }
          ]
      },
  "continueProcessingOnError": false,
  "rollbackParentOnChildError": false
}

Probably the Open Quote/Closed Quote thing.

ā€œā€ vs ""

@josecgomez ā€¦ Hey ā€¦ Iā€™m getting this JSON error when the session is getting disposed.

 at Newtonsoft.Json.JsonTextReader.ParseValue()
   at Newtonsoft.Json.JsonTextReader.Read()
   at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
   at EpicorRestAPI.EpicorRest.DynamicPost(String bo, String method, Object postData, Boolean replaceReturn, EpicorRestStatusCode responseStatusCode, CallContextHeader callContextHeader)
   at EpicorRestAPI.EpicorSession.Dispose(Boolean native)
   at EpicorRestAPI.EpicorSession.Dispose()

ā€¦ itā€™s happening in EpicorRest, showing [decompiled]:

Newtonsoft version is 11.02 but havenā€™t made any code changes to the project.

Any ideas?

UPDATE: It doesnā€™t seem to occur reliably. Can anyone surmise why/what circumstance this might happen?

Itā€™s lonely in hereā€¦ :man_shrugging:

Iā€™m having issues getting the EpicorRestAPI to work for me. Im guessing I have something setup incorrectly and that is the issue. If Someone could help with this I would appreciate it.

 Dictionary<string, string> dic = new Dictionary<string, string>();
            CallContextHeader callContext = new CallContextHeader();
            dic.Add("$top", "10");

            EpicorRest.AppPoolHost = "erp.wi.com";
            EpicorRest.AppPoolInstance = "KineticTest";
            EpicorRest.UserName = "UserName";
            EpicorRest.Password = "Password";
            EpicorRest.Company = "Company";
            EpicorRest.APIKey = "Key";
            EpicorRest.APIVersion = EpicorRestVersion.V2;

            var data = EpicorRest.BoGet("Erp.Bo.PartRevSearchSvc", "A14C", dic, callContext);

Hi Tim, welcome. Have you instantiated/initialized the EpicorRest object?

Iā€™m still using V1 but hereā€™s a basic setup:

EpicorRest.AppPoolHost = AppPoolHost;
EpicorRest.AppPoolInstance = AppPoolInstance;
EpicorRest.UserName = UserName;
EpicorRest.Password = Password;
EpicorRest.BearerToken = BearerToken;
EpicorRest.IgnoreCertErrors = false;

if (UseWebServicesLicence) EpicorRest.License = EpicorLicenseType.WebService;
else EpicorRest.License = EpicorLicenseType.Default;

EpicorRest.CallSettings = new CallSettings(CompanyID, String.Empty, String.Empty, String.Empty);

Jeff thanks for the quick response. Mine looks like itā€™s set up pretty much like yours.

Lot me check those search BOs are funky does it work in swagger??

Though it looks like a REsT Sharp error do you have to r dependencies installed?

Thanks for Responding Jose. I was able to do it in swagger and in postman. I have loaded the libraries for restsharp 109.0.1 and I am using the 2.1.0.3 version of EpicorRestAPIā€¦

Yes looks like it canā€™t find the constructor for RestClient.

I would try removing the dependencies and add them back in case something went haywire.

Kevin I uninstalled and reinstalled restsharp and still get the error is there a different version of restsharp I should be using? when I look at NuGet it shows no dependencyā€™s so Iā€™m not sure which version of RestSharp Iā€™m supposed to be usingā€¦

I havenā€™t done a lot of rest calls against Epicor so I actually have not had the opportunity to use @josecgomez tool, so I was just speaking in general.

What version of .Net?

.net 4.8

ok yeah you arenā€™t setting up that call correctly.
PartRevSearch has two ODataEnd Points
/PartRevSearches [GET] [POST]
and
.PartRevSearches(ā€˜Companyā€™,ā€˜Partā€™,ā€˜Revā€™,ā€˜Altā€™,ā€˜ProcessMfgā€™) [Get][Delete][Patch]

You arenā€™t calling either of these.

You are doing a BO Get on Erp.BO.PartRevSearchSvc/A14C ā† which isnā€™t a valid end point. Iā€™m Assuming you are trying to get the revisions for a Part number Called A14C? In that case the call should be

[GET] Erp.BO.PartRevSearchSvc/PartRevSearches?$filter=PartNum eq ā€˜A14Cā€™

Which in my LIbrary would be something like

 Dictionary<string, string> dic = new Dictionary<string, string>();
dic.Add("$filter","PartNum eq 'A14c'");

var data = EpicorRest.BoGet("Erp.BO.PartRevSearchSvc", "PartRevSearches", dic, callContext);

(sorry to inject my own question during your flow here Tim)

Anyoneā€¦ I have a BAQ that accepts a parameter @DataTags that is used in the BAQ Designer in a Table Criteria where the table field is IN clause the @DataTags list.

image

Because the field is a string, in SQL this would yield something like "ā€¦WHERE field IN (ā€˜stringAā€™, ā€˜stringBā€™, ā€˜stringCā€™) ā€¦ " but I donā€™t know how to pass that parameter so that it will work via the client.

Anyone have any helpful tips here?

Add the same parameter over and over again. (its kind of hard to do with a dictionary though :neutral_face:

1 Like

Let me see I think I have a way stand by doing some testing.

ā€¦ I could still leave the BAQ Table Criteria as in IN? The IN clause is an OR state, correct? I donā€™t want a field = ā€˜string1ā€™ AND field = ā€˜string2ā€™ AND field = ā€˜string3ā€™ ā€¦ is the concern with what youā€™re suggesting, no?

You donā€™t ahve to change the BAQ passing the same paramter over and over again fills in that ParamList. Stand by doing some testing.