We use cookies to make HubSpot's community a better place. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. To learn more, and to see a full list of cookies we use, check out our Cookie Policy (baked goods not included).
Jul 7, 2021 4:27 AM
I am having issues using Hubspot API with httr. Basically, I keep getting a 415 error when I submit my query.
Here is my code which corresponds to the API example...
library(httr)
api_key=Sys.getenv("HUBSPOT_API_KEY")
url=paste0("https://api.hubapi.com/crm/v3/objects/companies/search?hapikey=",api_key)
query_header ="Content-Type: application/json"
body_data= '{"city": "Cambridge","domain": "biglytics.net","industry": "Technology","name": "Test API Biglytics","phone": "(877) 929-0687","state": "Massachusetts"}'
POST(url,
body=body_data,
header=query_header,
encode="raw",
verbose())
This returns me a 415 error.
Here is the link to the examples if needed: https://developers.hubspot.com/docs/api/crm/companies
Pretty sure I am doing a silly mistake there, but can't figure it out.
Thanks in advance for your help.
Jul 12, 2021 10:37 AM
Did you get this figured out?
Your body_data does not seem to be formatted in a way the search endpoint would expect.