APIs & Integrations

Nusnus
Contributor

Create a Company API fails with official example data

SOLVE

Hello,

 

I've tried to use the company creation API as described here:

https://developers.hubspot.com/docs/methods/companies/create_company

 

I've tried to create it into my portal dorky of id 5560072

 

This is how I tried to use it (with my correct API key of course):

curl --header "Content-Type: application/json" --request POST --data '{"properties": [{"property": "name", "value": "A company name"}, {"property": "description", "value": "A company description"}]}' https://api.hubapi.com/companies/v2/companies?hapikey=aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa

This is the result I got:

{  
   "validationResults":[  
      {  
         "isValid":false,
         "message":"Property \"\" does not exist",
         "error":"PROPERTY_DOESNT_EXIST",
         "name":""
      },
      {  
         "isValid":false,
         "message":"Property \"\" does not exist",
         "error":"PROPERTY_DOESNT_EXIST",
         "name":""
      }
   ],
   "status":"error",
   "message":"Property values were not valid",
   "correlationId":"9eaf42bf-b2c8-48de-9841-a74f6b574a4d",
   "requestId":"28f942491c427a23f92591e7dd56251f"
}

Am I using it wrong or is that a bug in HubSpot's Companies API or something else maybe?

 

Basically what I am trying to do is just create a company from my code passing all of the relevant properties from my system in the company creation.

 

Thanks!

0 Upvotes
1 Accepted solution
Nusnus
Solution
Contributor

Create a Company API fails with official example data

SOLVE

Apparently the bug was in my data, using "property" instead of "name" there.

Everything works now!

 

I got confused because the contacts API uses "property" and companies API uses "name" and I didn't notice the difference.

 

Adding a python example could help in the future though 🙂

View solution in original post

1 Reply 1
Nusnus
Solution
Contributor

Create a Company API fails with official example data

SOLVE

Apparently the bug was in my data, using "property" instead of "name" there.

Everything works now!

 

I got confused because the contacts API uses "property" and companies API uses "name" and I didn't notice the difference.

 

Adding a python example could help in the future though 🙂