Import order for a specific customer

Have built a workflow automation microservice to import an order for a specific customer in CETEC using the POST [https://xxxxxxxx.cetecerp.com/api/importjson] endpoint. In order to do this we need the customer_id.

The microservice obtains the customer_id by searching for the customer with CETEC API using the GET [https://xxxxxx.cetecerp.com/api/customer] endpoint by acct_email. Where a customer is not found the microservice creates a new customer using the PUT [https://xxxxxxxx.cetecerp.com/api/customer] endpoint which returns the customer_id.

The above works very well, untill we create a new customer (by virtue email address not being found in CETEC customer list) who has the same name as an existing customer. In this case, because we’re using the PUT verb the CETEC API updates the customer with matching name and returns the customer_id of that customer with matching name - yet these are different customers with the same name. Thereby, the order is added to the wrong customer.

Why does the CETEC API have to create a customer using PUT instead of POST. If the endpoint requirement is to create a new customer if the customer is not found, why is the API matching by name which is not a unique identifier instead of unique attributes like email address or phone number?

In my view the current CETEC API is more difficult to use. Currently thinking of a workaround to overcome this caveat, and greatly appreciate your assistance on how you would implement our use case with the current CETEC API?

@arnold

Thanks for reaching out. I’ve sent this question over to our engineering team. I’ll get back to you ASAP with an update.

Thanks,

Cetec ERP Support

@arnold

Engineering is looking into adding a force_create: 1 flag to allow a new customer with the same name.

They expect it to be deployed in the next 2 weeks.

Thanks,

Cetec ERP Support

Greatly appreciate you developing a solution. Will wait on it.

@cetecerp23 Please provide feedback on whether the developers have added the force_create: 1 flag to allow a new customer with the same name?

regards,

@arnold

Engineering confirmed this has been added successfully.

Thanks,

Cetec ERP Support