MeToo2
(Matthew )
June 17, 2024, 4:14pm
1
I’m a heavy DMT user and am transitioning to more API call entries. We have a lot of ‘non-Epicor’ stuff happening on our shop floor hence the reason for the alternate entry methods. I’m a total (almost) newbie to API calls. I’m trying to feed the API like I would DMT and it’s not going. What is wrong with this LaborSvc POST call?
curl -X 'POST' \
'https://redacted/api/v2/odata/99927/Erp.BO.LaborSvc/LaborDtls' \
-H 'accept: application/json' \
-H 'X-API-Key: redacted \
-H 'Content-Type: application/json' \
-d '{
"Company": "99927",
"EmployeeNum": "100",
"LaborHedSeq": 9909909,
"LaborDtlSeq": 9909909,
"LaborType": "P",
"LaborTypePseudo": "P",
"JobNum": "P6B-test",
"AssemblySeq": 0,
"OprSeq": 10,
"LaborHrs": 0,
"BurdenHrs": 0,
"LaborQty": 10,
"Complete": true,
"LaborRate": 60,
"BurdenRate": 40,
"OpComplete": true,
"CompleteFlag": true,
"LotNum": "MF1111106162024"
}'
I get this: (Yes my Employee ID is valid when entered inm the UI)
{
"HttpStatus": 400,
"ReasonPhrase": "REST API Exception",
"ErrorMessage": "A valid Employee ID is required",
"ErrorType": "Ice.Common.BusinessObjectException",
"ErrorDetails": [
{
"Message": "A valid Employee ID is required",
"Type": "Error",
"Table": "LaborHed",
"Program": "Epicor.RESTApi.Common.dll",
"Method": "ThrowUpdateExtException",
"ColumnNumber": 17,
"LineNumber": 27
}
And humbling me is perfectly ok (call me dumb) if you have some help for me
1 Like
klincecum
(Kevin Lincecum)
June 17, 2024, 4:19pm
2
I edited your post and redacted your server and API-Key information.
Be careful with that…
3 Likes
MeToo2
(Matthew )
June 17, 2024, 4:24pm
3
Sorry, I should know better…
2 Likes
klincecum
(Kevin Lincecum)
June 17, 2024, 4:24pm
4
Probably want to go here, in the custom methods in swagger / rest help.
/server/api/help/v2/odata/Erp.BO.laborSvc/index.html?urls.primaryName=Custom%20methods#/Custom%20methods/Update
Use that endpoint.
You’ll want to send it a dataset with a LaborDtl
in it, formatted properly.
MeToo2
(Matthew )
June 17, 2024, 4:30pm
5
Am I looking at this properly then with onl;y passing fields that need ot be there like I owuld for DMT?
Also can I just delete out the LaborEquips and LaborComments if I don’t want them?
klincecum
(Kevin Lincecum)
June 17, 2024, 4:37pm
6
For this, probably.
Something like this is more like what you need, but I did not check it for correctness.
{
"ds": {
"LaborDtl": [
{
"Company": "99927",
"EmployeeNum": "100",
"LaborHedSeq": 9909909,
"LaborDtlSeq": 9909909,
"LaborType": "P",
"LaborTypePseudo": "P",
"JobNum": "P6B-test",
"AssemblySeq": 0,
"OprSeq": 10,
"LaborHrs": 0,
"BurdenHrs": 0,
"LaborQty": 10,
"Complete": true,
"LaborRate": 60,
"BurdenRate": 40,
"OpComplete": true,
"CompleteFlag": true,
"LotNum": "MF1111106162024",
"RowMod": "A"
}
]
}
}
1 Like
CSmith
(Clint Smith)
June 17, 2024, 4:38pm
7
Can you just use the UpdateExt method API as it only requires a minimal dataset?
1 Like
klincecum
(Kevin Lincecum)
June 17, 2024, 4:38pm
8
I would assume, but I think you can do minimals on some updates.
Absolutely not sure.
He could certainly just leave the other tables empty.
Hell I don’t know, I live in function land.
1 Like
MeToo2
(Matthew )
June 17, 2024, 6:33pm
10
Closer… I get this error:
"HttpStatus": 400,
"ReasonPhrase": "REST API Exception",
"ErrorMessage": "Invalid operation code.",
"ErrorType": "Ice.Common.BusinessObjectException",
"ErrorDetails": [
{
"Message": "Invalid operation code.",
"Type": "Error",
"Table": "LaborDtl",
"Program": "Epicor.RESTApi.Common.dll",
"Method": "ThrowUpdateExtException",
"ColumnNumber": 17,
"LineNumber": 27
When posting this code:
{
"Company": "99927",
"EmployeeNum": "100",
"LaborHedSeq": 9909909,
"PayrollDate": "2024-06-17T18:02:17.578Z",
"LaborDtls": [
{
"Company": "99927",
"EmployeeNum": "100",
"LaborHedSeq": 9909909,
"LaborDtlSeq": 9909909,
"LaborType": "P",
"LaborTypePseudo": "P",
"JobNum": "P6B_050223",
"AssemblySeq": 0,
"OprSeq": 10,
"LaborHrs": 1,
"BurdenHrs": 0,
"LaborQty": 1,
"Complete": true,
"LaborRate": 0,
"BurdenRate": 0,
"PayrollDate": "2024-06-17T18:03:23.301Z",
"LotNum": "MF1000006172024",
"RowMod": "A"
}
]
}
klincecum
(Kevin Lincecum)
June 17, 2024, 6:35pm
11
klincecum
(Kevin Lincecum)
June 17, 2024, 6:41pm
12
MeToo2:
this code:
Try this (and maybe try it on UpdateExt?):
{
"ds": {
"LaborHed": [
{
"Company": "99927",
"EmployeeNum": "100",
"LaborHedSeq": 9909909,
"PayrollDate": "2024-06-17T18:02:17.578Z"
}
],
"LaborDtls": [
{
"Company": "99927",
"EmployeeNum": "100",
"LaborHedSeq": 9909909,
"LaborDtlSeq": 9909909,
"LaborType": "P",
"LaborTypePseudo": "P",
"JobNum": "P6B_050223",
"AssemblySeq": 0,
"OprSeq": 10,
"LaborHrs": 1,
"BurdenHrs": 0,
"LaborQty": 1,
"Complete": true,
"LaborRate": 0,
"BurdenRate": 0,
"PayrollDate": "2024-06-17T18:03:23.301Z",
"LotNum": "MF1000006172024",
"RowMod": "A"
}
]
}
}
klincecum
(Kevin Lincecum)
June 17, 2024, 6:42pm
13
Forewarned, I’m really not paying that much attention, so may not be right.
Got my own fires going on.