Create company with same name of an existing one

It seems the API is not letting me create a company with the same name of an existing one.

The API actually replies by saying “code 201: created”, but the company ID is the one of the already present company and the company data is not updated with the new data.

I consider proper the behavior of not updating data on a CREATE call, but why can’t I create a company with the same name of an existing one if that is actually the reality that we are facing in the real world???

Hi @SIS_Safety_Security, this looks like this is particular condition that has been set in the REST API v1. The XML-RPC API would just create the Company for you.

Best way would be to check if the company exists first, and then update the existing if you have new data for you.

The “List Companies” function can search for the company by its name.
https://developer.infusionsoft.com/docs/rest/#operation/listCompaniesUsingGET

The “Update a Company” function will update the details, provided you give it the Company Id.
https://developer.infusionsoft.com/docs/rest/#operation/updateCompanyUsingPATCH

Ideally you want something like what the Contact API has which it has a “Create or update a Contact” function, but it works on the Company Name field.

Thank you @Pav.

Yes, I’m using REST API v1. The scripts I set up for migrating data from our current CRM into your solution does exactly as you are suggesting: I check if the company exist through specific custom fields that has been set up for the matter and then I patch or post based on the fact of the company already existing or not.

It felt very strange that your API replies “code 201: created” but it actually refuse to do anything. I think the reply should at least notified that it was not possible to create the company.

I worked around the problem by changing my data: the homonymous companies were about 50 … I slightly changed the names → the API created the companies → I updated the names ad I was able to properly migrate my data, but wouldn’t it be better to fix the API behavior or at least the API replies?

I do not work for Keap, I just help out in the forum.

@TomScott is a Keap API Engineer, he can comment on the technicalities.