REST API - Project Time Entry

I have spent quite some time trying to POST time entries to Epicor via their REST API.

I keep getting the error:
“HttpStatus”: 400,
“ReasonPhrase”: “REST API Exception”,
“ErrorMessage”: “A valid Employee ID is required”,

But I know for a fact that the Employee ID exists in the company being referenced. I am also able to GET entries I submitted with no problems.

Is there a good resource to read up on what services are required for certain entries? I have been attempting to use Erp.BO.LaborSvc/LaborDtls with the same data I was passing through DMT but am running into issues.

I do not know if I have to first create an entry using Erp.BO.LaborSvc/Labors and then submit details? There is not much documentation and the required fields are not labelled either so it is hard to figure out what is missing here.

Turn on client tracing and do your workflow in the ERP, you will get a list of what is called in the trace which then can be implemented in REST.

Gave this a try.

I see the system using Erp.Proxy.BO.LaborImpl to run a CheckWarning method and then Erp.Proxy.BO.LaborImpl uses the Update method with the parameters from the time entry screen.

Seems like other than a few methods to validate the data the system is just sending a the parameters to update the db. I think the validation would be handled when the API call is submitted to the server?
The services in the API do not necessarily match the objects I am seeing in the trace log so it is hard to figure out whats is missing.

Are you sure that the employee number isn’t losing any leading "000"s by being converted to numbers? I see that a lot.

No, I got it figured out.
I had to submit the LaborHed and LaborDtl together and include the company in both records. Everything seems to be hitting the system correctly now.

If it is any help to anyone else, here is the JSON structure I am using to submit project time:

{
“Company”: “”,
“EmployeeNum”: “”,
“Shift”: 0,
“PayrollDate”: “2020-08-18T21:47:31.681Z”,
“LaborDtls”:
[{
“Company”: “”,
“LaborTypePseudo”: “”,
“ClockinTime”: 0,
“ClockOutTime”: 0,
“ProjectID”: “”,
“JobNum”: “”,
“PhaseID”: “”,
“PhaseOprSeq”: 0,
“OprSeq”: 0,
“OpCode”: “”,
“JCDept”: “”,
“ResourceGrpID”: “”,
“ExpenseCode”: “”
}]
}

2 Likes

Dude! Thanks for the extra effort