Can't delete a customer object

SOLVE
JZhao
Member

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 Accepted solution

Accepted Solutions
rOsborn123
Solution
Contributor | Elite Partner

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 

View solution in original post

8 Replies 8
himanshurauthan
Recognized Expert | Platinum Partner

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
Member

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
Recognized Expert | Platinum Partner

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 Upvotes
JZhao
Member

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

dennisedson
Community Manager

Hi @JZhao 

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

Thanks,

Dennis




Check out our Community Developer Blog
where we feature our Community driven developer podcast and how to content
JZhao
Member

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 Upvotes
rOsborn123
Solution
Contributor | Elite Partner

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 

View solution in original post

JZhao
Member

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

0 Upvotes