Invalid input JSON

Please could someone assist me?
I definitely have the property setup in Hubspot with the internal name “min_battery_percentage”
I definitely have the write permissions on my app authorisation code.
Why am I still getting the following messages?

data = {'min_battery_percentage': 17.0}

bearer_token = str("Bearer " + os.getenv("HUBSPOT_AUTH"))

payload = data
 json_payload = json.dumps(payload)
 headers = {
 'Authorization': bearer_token,
 'accept': "application/json",
 'content-type': "application/json"
 }
 # Make a GET request to the API
 response = requests.request("PATCH", url, headers=headers, data=json_payload)

'{"status":"error","message":"Invalid input JSON on line 1, column 24: Unrecognized token \'min_battery_percentage\': was expecting (JSON String, Number, Array, Object or token \'null\', \'true\' or \'false\')","correlationId":"5dadc2ba-c921-4325-8c71-d10587de7136"}'

Thanks in advance

Hi @SSattary,

HubSpot expects properties to be nested under “properties” in the payload.
Instead of:

data = {'min_battery_percentage': 17.0}

Use:

data = {
 'properties': {
 'min_battery_percentage': 17.0
 }
}

Depending on your property, you may also need to update the ‘17.0’ to be a string value:

data = {
 'properties': {
 'min_battery_percentage': '17.0'
 }
}

Hope this helps!

This definitely helped the situation as the Error message has changed, thank you. I’ve tried sending 17.0 as a float and string, but get the following error message.

2024-12-19 10:11:51.293593 :: WARNING - Uploading to Hubspot failed: 200 - {"id":"44291661796","properties":{"createdate":"2024-10-07T17:46:55.792Z","hs_all_owner_ids":"973091571","hs_count_is_unworked":"0","hs_count_is_worked":"1","hs_created_by_user_id":"71829241","hs_is_unworked":"false","hs_object_id":"44291661796","hs_object_source":"CRM_UI","hs_object_source_id":"userId:71829241","hs_object_source_label":"CRM_UI","hs_object_source_user_id":"71829241","hs_pipeline":"contacts-lifecycle-pipeline","hs_time_to_first_engagement":"6275352795","hs_updated_by_user_id":"71829241","hs_user_ids_of_all_owners":"71829241","hubspot_owner_assigneddate":"2024-10-07T17:46:55.792Z","hubspot_owner_id":"973091571","lastmodifieddate":"2024-12-19T08:56:22.656Z","lifecyclestage":"lead","min_battery_percentage":"17.0","notes_last_updated":"2024-12-19T08:56:08.587Z"},"createdAt":"2024-10-07T17:46:55.792Z","updatedAt":"2024-12-19T08:56:22.656Z","archived":false}

Any suggestions would be greatly appreciated. I’m Patching to

https://api.hubapi.com/crm/v3/objects/contacts/<customer id number>

Thank you this has definitely helped as the error message has changed. I’ve tried sending 17.0 as a float and string, but get the same message below. Any suggestions?
I’m posting to:

https://api.hubapi.com/crm/v3/objects/contacts/<customer_id>

2024-12-19 10:11:51.293593 :: WARNING - Uploading to Hubspot failed: 200 - {"id":"44291661796","properties":{"createdate":"2024-10-07T17:46:55.792Z","hs_all_owner_ids":"973091571","hs_count_is_unworked":"0","hs_count_is_worked":"1","hs_created_by_user_id":"71829241","hs_is_unworked":"false","hs_object_id":"44291661796","hs_object_source":"CRM_UI","hs_object_source_id":"userId:71829241","hs_object_source_label":"CRM_UI","hs_object_source_user_id":"71829241","hs_pipeline":"contacts-lifecycle-pipeline","hs_time_to_first_engagement":"6275352795","hs_updated_by_user_id":"71829241","hs_user_ids_of_all_owners":"71829241","hubspot_owner_assigneddate":"2024-10-07T17:46:55.792Z","hubspot_owner_id":"973091571","lastmodifieddate":"2024-12-19T08:56:22.656Z","lifecyclestage":"lead","min_battery_percentage":"17.0","notes_last_updated":"2024-12-19T08:56:08.587Z"},"createdAt":"2024-10-07T17:46:55.792Z","updatedAt":"2024-12-19T08:56:22.656Z","archived":false}

Sorry if you’ve recieved this twice, I thought it posted, but can’t find it anywhere