EpicorRest C# library - Trouble with Delete UD record

Trying to delete all UD records with the following code:

            var Results = EpicorRest.DynamicPost("Ice.BO.UD100Svc", "GetList",new { whereClause="", pageSize =0, absolutePage =0});
            foreach (var item in Results.ds.UD100List)
            {
                EpicorRest.DeleteUDRecord("UD100", "78863", item.Key1.Value.ToString(), item.Key2.Value.ToString(), item.Key3.Value.ToString(), item.Key4.Value.ToString(), item.Key5.Value.ToString());
                // MessageBox.Show(EpicorRest.LastCallResult.ToString());
            }

It correctly loops through every record, but I get a not found error for each item and it does not delete them. I have checked the keys and the records do seem to exist. Not sure what the issue is…

Can you paste the call log. Is a property on the library after the call I think is CallRequestLog or something like that

The first entry in the log is too long as it contains the results for the GetList. The second command for deleting has an error it looks like though. I tried deleting through the Swagger UI and I get the same "OData path is undefined for the request " error. I am going to try deleting via the custom method and see if that works.

Request completed in 73 ms,
 [{"Request":{"resource":null,"parameters":[{"name":"cache-control","value":"no-cache","type":"HttpHeader"},{"name":"authorization","value":"Basic Nzg4NjMtZXB1cmR5OlNhbXNjcmVlbjA0MTk=","type":"HttpHeader"},{"name":"Accept","value":"application/json, application/xml, text/json, text/x-json, text/javascript, text/xml","type":"HttpHeader"}],"method":"DELETE","uri":"https://ausmtspilot102.epicorsaas.com/SaaS203Pilot/api/v1/Ice.BO.UD100Svc/UD100s('78863',%20'1200%20Chieftain',%20'Bottom',%20'5x5',%20'(Feed%20Panel)',%20'90BF39CE-1300-4CB6-B1EF-0B542A431AE3')"}}
, {"Response":{"statusCode":404,"content":"{\"HttpStatus\":404,\"ReasonPhrase\":\"REST API Exception\",\"ErrorMessage\":\"OData path is undefined for the request https://ausmtspilot102.epicorsaas.com/SaaS203Pilot/api/v1/Ice.BO.UD100Svc/UD100s('78863', '1200 Chieftain', 'Bottom', '5x5', '(Feed Panel)', '90BF39CE-1300-4CB6-B1EF-0B542A431AE3')\",\"ErrorType\":\"Epicor.RESTApi.ErrorHandling.ApiException\"}","headers":[{"Name":"Content-Length","Value":"348","Type":3,"ContentType":null},{"Name":"Cache-Control","Value":"private","Type":3,"ContentType":null},{"Name":"Content-Type","Value":"application/json; charset=utf-8","Type":3,"ContentType":null},{"Name":"Date","Value":"Mon, 08 Apr 2019 12:27:00 GMT","Type":3,"ContentType":null},{"Name":"Server","Value":"Microsoft-IIS/8.5","Type":3,"ContentType":null},{"Name":"X-AspNet-Version","Value":"4.0.30319","Type":3,"ContentType":null},{"Name":"X-Powered-By","Value":"ASP.NET","Type":3,"ContentType":null}],"responseUri":"https://ausmtspilot102.epicorsaas.com/SaaS203Pilot/api/v1/Ice.BO.UD100Svc/UD100s('78863',%20'1200%20Chieftain',%20'Bottom',%20'5x5',%20'(Feed%20Panel)',%20'90BF39CE-1300-4CB6-B1EF-0B542A431AE3')","errorMessage":null}}]

oData Path is undefined for request… HMM… ok let me check something.

Replacing the DeleteUDRecord line with the custom method is deleting them all fine:

EpicorRest.DynamicPost("Ice.BO.UD100Svc", "DeleteByID", new { key1 = item.Key1.Value.ToString(), key2 = item.Key2.Value.ToString(), key3 = item.Key3.Value.ToString(), key4 = item.Key4.Value.ToString(), key5 = item.Key5.Value.ToString() });
1 Like

Fair enough I’ll investigate why the regular call is failing. We’ve mostly moved to the Dyanmic methods which (as you saw) work a lot better.

1 Like

Thanks, I figured I was doing something wrong at first, but when I tried using the OData method via swagger and got the same error I realized I probably should have tried the custom method before asking for help.

I think its an Epicor problem not a problem with your code.

1 Like

Yeah I just had the same issue in my test box, I’m guessing there’s a bug in that method.

1 Like