APIs & Integrations

sbeller
Member

UpdateCompany does not recognize token 'properties'

SOLVE

Making a request to the update company endpoint with the following payload
{'properties': [{'name': 'entity_id', 'value': '5b084b26d5ff2a48c901984f'}]}
Results in the following message returned

{ "status":"error", "message":"Invalid input JSON on line 1, column 12: Unrecognized token \'properties\': was expecting (\'true\', \'false\' or \'null\')","correlationId":"redacted","requestId":"redacted" }

Please respond promptly, this project is time sensitive.

0 Upvotes
1 Accepted solution
sbeller
Solution
Member

UpdateCompany does not recognize token 'properties'

SOLVE

The problem is that the python requests library is not automatically json formatting data. A call to json.dumps(data) fixes this

View solution in original post

6 Replies 6
sbeller
Member

UpdateCompany does not recognize token 'properties'

SOLVE

@Derek_Gervais

Here's a more well-formatted example request

PUT /companies/v2/companies/966428687?hapikey=[redacted] HTTP/1.1

Host: api.hubapi.com

Connection: keep-alive

Accept-Encoding: gzip, deflate

Accept: */*

User-Agent: python-requests/2.19.1

Content-Type: application/json

Content-Length: 32

properties=name&properties=value
0 Upvotes
sbeller
Solution
Member

UpdateCompany does not recognize token 'properties'

SOLVE

The problem is that the python requests library is not automatically json formatting data. A call to json.dumps(data) fixes this

Derek_Gervais
HubSpot Alumni
HubSpot Alumni

UpdateCompany does not recognize token 'properties'

SOLVE

Hi @plumSemPy & @sbeller,

It's tough to say without knowing exactly how the JSON libraries you're using are working, but it seems like it's unsuccessfully parsing the object body into proper JSON. The JSON body must use double quotes, so if for whatever reason the library you're using isn't properly updating the request body that would explain it.

0 Upvotes
Derek_Gervais
HubSpot Alumni
HubSpot Alumni

UpdateCompany does not recognize token 'properties'

SOLVE

Hi @sbeller,

I'm wondering if the issue has to do with the use of single quotes? Is it possible they're being escaped somehow, malforming the request? Can you try changing the request JSON to use double quotes? If that doesn't solve the issue, can you give me the details of the request you're making (full URL, headers, etc.) and your Hub ID so that I can dig in more?

0 Upvotes
Not applicable

UpdateCompany does not recognize token 'properties'

SOLVE

Hey @Derek_Gervais I am having the same issue on updating contacts with vid: https://api.hubapi.com/contacts/v1/contact/vid/:vid/profile

here is my response: {'message': "Invalid JSON input: Unrecognized token 'properties': was expecting ('true', 'false' or 'null') at line 1, column 12", 'status': 'error', 'requestId': '86139ed372f9a29085952360276681b3', 'correlationId': 'a7e39a50-2c42-4adf-a822-e787268329e0'}

and here is my body: {'properties': [{'value': 'some@email.com', 'property': 'email'}]}

could you please help me navigate this? (the single quote is how python represents objects, the library takes care of jsonifying, and other requests work correctly with single quotes)

0 Upvotes
sbeller
Member

UpdateCompany does not recognize token 'properties'

SOLVE

I happen to be coming back around to this after working around this originally. I'm now blocked on this endpoint.

0 Upvotes