APIs & Integrations

JZhao
Participante

Can't delete a customer object

resolver

What is the process to delete a customer object completely? I created a customer object and delete it by calling two APIs:

 

DELETE /crm/v3/schemas/{objectType}

DELETE /crm/v3/schemas/{objectType}/purge

 

both API returns successfully. However, I got "already existing" error when I try to re-create the object with the same name:

 

{
"status": "error",
"message": "p8013920_device already exists",
"correlationId": "7a19ce21-0e8b-4cee-8076-f7fa9bc4b0da",
"context": {
"name": [
"p8013920_device"
]
},
"category": "OBJECT_ALREADY_EXISTS",
"subCategory": "InboundDbObjectTypeError.OBJECT_TYPE_ALREADY_EXIST"
}
 
It keeps telling me the object already exists. How can I re-create the same object after deleting?
1 Soluciones aceptada
rOsborn123
Solución
Colaborador | Partner nivel Elite
Colaborador | Partner nivel Elite

Can't delete a customer object

resolver

Hit this endpoint:
DELETE /crm/v3/schemas/{objectType}?archived=true
after hitting

DELETE /crm/v3/schemas/{objectType}
Then you'll be able to create a new custom object with the same name. It's in the docs and I've done it many times before 

Ver la solución en mensaje original publicado

9 Respuestas 9
rOsborn123
Solución
Colaborador | Partner nivel Elite
Colaborador | Partner nivel Elite

Can't delete a customer object

resolver

Hit this endpoint:
DELETE /crm/v3/schemas/{objectType}?archived=true
after hitting

DELETE /crm/v3/schemas/{objectType}
Then you'll be able to create a new custom object with the same name. It's in the docs and I've done it many times before 

JZhao
Participante

Can't delete a customer object

resolver

I already did DELETE /crm/v3/schemas/{objectType}?archived=true but it shows it doesn't exist error.

0 Me gusta
dennisedson
Equipo de producto de HubSpot
Equipo de producto de HubSpot

Can't delete a customer object

resolver

Hi @JZhao 

Make sure that there are no records exist  within the the Custom Object before using the DELETE /crm/v3/schemas/{objectType}

JZhao
Participante

Can't delete a customer object

resolver

As I already mentioned in the question, the two API are run successfully

 

DELETE /crm/v3/schemas/{objectType}

DELETE /crm/v3/schemas/{objectType}/purge

 

that means no records exist otherwise these API will fail.

 

The question is how to recreate the object with the same name. It doesn't allow me to create the customer object with the same name and the error is object already exists. How can I delete the customer object completely?

0 Me gusta
mathew_murphy
Participante

Can't delete a customer object

resolver
0 Me gusta
himanshurauthan
Líder intelectual | Partner nivel Elite
Líder intelectual | Partner nivel Elite

Can't delete a customer object

resolver

Hi @JZhao,

 

Are you deleting the objects first before making the delete request?

 

Before deleting the schema, any existing records of this schema must be deleted first otherwise, this call will fail.

If it's a success then please make sure after fetching the schema again, check if it includes the deleted one or not.

 

Regards,

 

Digital Marketing & Inbound Expert In Growth Hacking Technology
JZhao
Participante

Can't delete a customer object

resolver

I already deleted all objects for the secheme. I am able to query sechema with archive=true which means they are not deleted completely. I have tried to delete and purge them as I mentioned above but none of them works. How can I delete them?

himanshurauthan
Líder intelectual | Partner nivel Elite
Líder intelectual | Partner nivel Elite

Can't delete a customer object

resolver

Thank you for the clarification @JZhao.

 

I tested the same and haven't found any API to delete it completely.

 

What I'll suggest here is - if you want to re-use the schema, instead of recreating it let's update it.

 

But if we need the deleted endpoint, I hope someone from the HubSpot development team can answer it.

 

Regards,

Digital Marketing & Inbound Expert In Growth Hacking Technology
0 Me gusta
JZhao
Participante

Can't delete a customer object

resolver

Thanks @himanshurauthan , thanks for testing it. Do you know who can help on that?