Issues with upserts via REST aPI
I am checking my system at regular intervals for for Customers and Employees that do not have their corresponding Netsuite ID stored. I’ll first try to update each Customer and Employee using a PUT and the external id in the request url. If I receive a 404 I then attempt a POST to create a new Customer/Employee.
The problem I’m having is that when I attempt the creates I am getting a 400 with the error detail “Error while accessing a resource. This entity already exists.” I have been able to create some new Customers and Employees using random data in Postman (as a control), so not all values used for the external id result in these 400s.
The company name does not cause the “entity already exists” error, that error is linked exclusively to the ExternalId of the Customer/Employee. When I conduct a SuiteQL query such as select from customer where externalid = '{eid}'
I do not find any matches. So, I can create new Customers/Employees with some external ids, but there are a number of ids that are resulting in the 400 errors I described above.
The external ids that are causing me issues are all ints,. I can create an Employee with an ID of ‘4’., but when I attempt to create an Employee for ‘5’ I get the 400 error.
Any ideas? Are Employees and Customers stored in the same table?
Update: I found the documentation that shows which entities use shared ids. Customer and Employee share external and internal ids. Here’s a link to the doc: https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_N3436356.html