jpetrucciani / hubspot3

python3.6+ hubspot client based on hapipy, but modified to use the newer endpoints and non-legacy python
MIT License
146 stars 72 forks source link

Updating a Hubspot Company is not doing anything #101

Open tbleiermedialab opened 3 years ago

tbleiermedialab commented 3 years ago

Hi,

I'm struggling to get the update function in the company client to work.

def update(self, company_id: str, data: Dict = None, options) -> Dict: """update the given company with data""" data = data or {} return self._call( "companies/{}".format(company_id), data=data, method="PUT", options )

I'm wondering if its asking for data, but the request in the Hubspot API is looking for properties. Would this be causing it not to work? For example, the sample JSON hubspot is showing in the API, https://legacydocs.hubspot.com/docs/methods/companies/update_company, is expecting properties, not data. The sample JSON given, is: Example PUT JSON: { "properties": [ { "name": "description", "value": "A far better description than before" } ] }

Right now I'm calling the function with: updateCompanyDict = { "name":"rpm_id", "value":rpmCustomerAccountId }

response = companies_client_update.update(company_id=company.companyId, data=updateCompanyDict, debug=True)

The debug for the request above shows: { "data": "{\"name\": \"rpm_id\", \"value\": 1286}", "headers": { "Accept-Encoding": "gzip", "Content-Type": "application/json" }, "url": "/companies/v2/companies/4326408039?hapikey=hapikey" }

where hapikey, is our key.

Can you please shed some light?