APIs & Integrations

barteksonarhome
Contributor

Create custom_object doesn't work

SOLVE

Hi. I have created a custom object by "post /crm/v3/schemas". I have deleted it by "delete /crm/v3/schemas/object_id". When I "get  /crm/v3/schemas" I don't get this new custom object. But when I try again "post /crm/v3/schemas" a get "category":"OBJECT_ALREADY_EXISTS","subCategory":"InboundDbObjectTypeError.OBJECT_TYPE_ALREADY_EXIST"

I deleted custom object with
1. delete /crm/v3/schemas/object_id
2. delete /crm/v3/schemas/object_id/purge
3. delete /crm/v3/schemas/object_id?archived=true
4. delete /crm/v3/schemas/object_id/purge?archived=true

Frontend settings -> objects -> custom objects (https://app.hubspot.com/sales-products-settings/XXXXX/object/YYYY) don't show my custom object (API after new POST say "already exists")

Please help me.


0 Upvotes
1 Accepted solution
barteksonarhome
Solution
Contributor

Create custom_object doesn't work

SOLVE

@webdew I already use this API. Please read my first message.

I have quite a good solution.

for 1..100 do
  post /crm/v3/schemas { FOO } -> FOO id = 2-111111
  delete /crm/v3/schemas/2-111111
  delete /crm/v3/schemas/2-111111?archived=true
  delete /crm/v3/schemas/2-111111/purge
  post /crm/v3/schemas { FOO } -> FOO id = 2-222222
  result = get /crm/v3/schemas
  if result includes FOO => success += 1
end

the success rate is around 60%. For HubSpot API is a pretty good result 🙂

Thanks for all answers!

View solution in original post

4 Replies 4
webdew
Guide | Diamond Partner
Guide | Diamond Partner

Create custom_object doesn't work

SOLVE

Hi @barteksonarhome  ,

Please use this test api's for custom objects:

 

https://developers.hubspot.com/docs/api/crm/crm-custom-objects

 

webdew_0-1639060126669.png

webdew_2-1639060281744.png

 

Hope this helps!
If we were able to answer your query, kindly help the community by marking it as a solution.
Thanks and Regards.

0 Upvotes
barteksonarhome
Solution
Contributor

Create custom_object doesn't work

SOLVE

@webdew I already use this API. Please read my first message.

I have quite a good solution.

for 1..100 do
  post /crm/v3/schemas { FOO } -> FOO id = 2-111111
  delete /crm/v3/schemas/2-111111
  delete /crm/v3/schemas/2-111111?archived=true
  delete /crm/v3/schemas/2-111111/purge
  post /crm/v3/schemas { FOO } -> FOO id = 2-222222
  result = get /crm/v3/schemas
  if result includes FOO => success += 1
end

the success rate is around 60%. For HubSpot API is a pretty good result 🙂

Thanks for all answers!

barteksonarhome
Contributor

Create custom_object doesn't work

SOLVE

@KyleParkerUnfortunately I use object id formatted p{accout_id}object_name.

Ok, I tried multiple times to delete schema by p-start id and 2-start id. Now object successfully deleted.

But still, I don't know how to
1. Create custom_object type Foo
2. Delete custom_object type Foo
3. Create the same custom_object type Foo

Anybody knows how to do it?

0 Upvotes
KyleParker
Contributor

Create custom_object doesn't work

SOLVE

@barteksonarhome  are you using the object id formatted with the dash (e.g. 2-xxx)? 

 

I encountered a similar issue when using call #1, but as soon as I used #3, I was able to recreate a new custom object using the same name.

 

DELETE https://api.hubspot.com/crm/v3/schemas/2-xxx?archived=true

0 Upvotes