why this payload is giving me an Error:422 "error": "Inserting 'Address' record raised at least one error. Please review the errors.; CountryID: 'Country' cannot be empty.",
{
"Status": {"value": "Active"},
"EmployeeID": {"value": "CRIC123789"},
"EmployeeName": {"value": "Doe, Jane"},
"FinancialSettings":
{
"APAccount": {"value": "ACCOUNT123"},
"APSubaccount": {"value": "000000"},
"ExpenseAccount": {"value": "ACCOUNT456"},
"PaymentMethod": {"value": "CHECK"},
"PrepaymentSubaccount": {"value": "000000"},
"SalesAccount": {"value": "ACCOUNT789"},
"TaxZone": {}
},
"EmployeeSettings":
{
"BranchID": {"value": "CRIC012345"},
"Calendar": {"value": "NEWCAL1234"},
"CurrencyID": {"value": "USD"},
"CurrencyRateTypeID": {"value": "SPOT"},
"DepartmentID": {"value": "1"},
"EmployeeClass": {"value": "EMPCLASSNE"}
},
"ContactInfo":
{
"LastName": {"value": "Doe"}
},
"Address":
{
"CountryID":{"value":"India"}
}
}
Error in creating the employee via Rest API
Best answer by farhanshaik
Hi laura,
thanks for replying back..
i’ve resolved my issue and the problem was
in APi’s
it is considering the “country” as the abbrebviation(IN) and not the “countryID”
and also the object “Address” is a sub-object of “ContactInfo” whereas i was considering it as a different object itself
Here is the Correct Payload.. You can have a look at it
Acumatica create Employee payload:
{
"Status": {"value": "Active"},
"EmployeeID": {"value": "CRIC123789"},
"EmployeeName": {"value": "Doe, Jane"},
"FinancialSettings":
{
"APAccount": {"value": "ACCOUNT123"},
"APSubaccount": {"value": "000000"},
"ExpenseAccount": {"value": "ACCOUNT456"},
"PaymentMethod": {"value": "CHECK"},
"PrepaymentSubaccount": {"value": "000000"},
"SalesAccount": {"value": "ACCOUNT789"},
"TaxZone": {}
},
"EmployeeSettings":
{
"BranchID": {"value": "CRIC012345"},
"Calendar": {"value": "NEWCAL1234"},
"CurrencyID": {"value": "USD"},
"CurrencyRateTypeID": {"value": "SPOT"},
"DepartmentID": {"value": "1"},
"EmployeeClass": {"value": "EMPCLASSNE"}
},
"ContactInfo":
{
"LastName": {"value": "Doe"},
"Address":
{
"Country":{"value":"IN"}
}
}
}
Thank you
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.