APIs & Integrations

datetime
Member

Company datetime property

SOLVE

Hi, first post here:

I currently have a custom Company property that is of type "date". I want to change it to "datetime". I understand this has to be done using the API, but the docs specifically talk about Contact properties for datetime so I'm not sure if it's supported, or if I'm doing something incorrectly.

Based on a combination of these documentation pages:

How should timestamps be formatted for HubSpot's APIs?

HubSpot API endpoints accept UNIX formatted timestamps in milliseconds. Most scripting languages have built-in functions or existing libraries that handle time conversion, but you must ensure that your timestamp values are in the correct UNIX...



I have attempted to change the property type like this:

URL: https://api.hubapi.com/properties/v1/companies/properties/named/sign_up_date?hapikey=XXXXXX
Method: PUT
Body:
{
"label": "Sign-up Date",
"type": "datetime",
"groupName": "custom_data",
}

Response:
HTTP/1.1 415 Unsupported Media Type

The response also had a bunch of cloudflare stuff that I omitted from the above as I believe it is not relevant.

This is the first time I have attempted to change a company property, and the documentation is not as clear as for a Contact property.

Questions:

  1. Am I formatting my request body and URL correctly?
  2. Does the Company Property API support "datetime" as a type?

In addition, I just tried creating a new property, but received the same response. My POST body to create the new property was this:
{
"name": "sign_up_datetime",
"label": "Sign up Datetime",
"description": "The date the company signed up",
"groupName": "custom_data",
"type": "datetime",
"fieldType": "datetime"
}

Any help is appreciated.

Thanks,
Dave

0 Upvotes
1 Accepted solution
datetime
Solution
Member

Company datetime property

SOLVE

My bad, was missing the content-type header on my request. This is working properly now with content-type:appdlication/json.

View solution in original post

1 Reply 1
datetime
Solution
Member

Company datetime property

SOLVE

My bad, was missing the content-type header on my request. This is working properly now with content-type:appdlication/json.