Batch Company Update - 400 Response

companies

#1

Hey Folks,

I am trying to use the batch company update api (/companies/v1/batch-async/update) with little success. My first attempts yielded a 200 response, so I did some digging and saw that I need to specify the content-type as json. Changed that, and now I'm getting 400 errors. Help!

HS_API_URL = "https://api.hubapi.com"
xurl = "/companies/v1/batch-async/update"
postUrl = HS_API_URL + xurl + REDACTEDAPIKEY

headers = {'content-type':'application/json'}              
r = requests.post(postUrl, headers=headers, data=tempJson)

json
[{"objectId": 115272811, "properties": [{"name": "last_sales_email_replied_date", "value": 112}]}, {"objectId": 114942341, "properties": [{"name": "last_sales_email_replied_date", "value": 142}]}, {"objectId": 114940551, "properties": [{"name": "last_sales_email_replied_date", "value": 582}]}, {"objectId": 114941356, "properties": [{"name": "last_sales_email_replied_date", "value": 544}]}, {"objectId": 115271946, "properties": [{"name": "last_sales_email_replied_date", "value": 572}]}]


#2

Nevermind. Solved.


#3

Glad you figured it out!


#4

Note for others:

If you are trying to overwrite a hubspot only field, it will throw a 400 error. I was being stupid and looking at the wrong field.

-Matt