Yeah, I am also having the same issues. I can’t find any reason why the validation would fail. I have done this many times in the past. Not sure if there has been a change in the validation requirements?
I followed the link you provided and joined the beta, but it’s still the same, gives me validation error for all the fieldTypes that I tried since they don’t match the Type (datetime):
curl --request POST \
--url https://api.hubapi.com/crm/v3/properties/contacts \
--header ‘authorization: Bearer YOUR_ACCESS_TOKEN’ \
--header ‘content-type: application/json’ \
--data ‘{
“hidden”: false,
“displayOrder”: 2,
“description”: “string”,
“label”: “DateTime Test”,
“type”: “datetime”,
“groupName”: “contactinformation”,
“name”: “datetimetest”,
“fieldType”: “date”,
“formField”: true,
“referencedObjectType”: “string”,
“options”: [
{
“label”: “Option A”,
“value”: “A”,
“hidden”: false,
“description”: “Choice number one”,
“displayOrder”: 1
},
{
“label”: “Option B”,
“value”: “B”,
“hidden”: false,
“description”: “Choice number two”,
“displayOrder”: 2
}
],
“calculationFormula”: “string”,
“hasUniqueValue”: false,
“externalOptions”: true
}’
However, what I mean is after that, I have to also select the fieldType parameter, that one doesn’t have the datetime option even after I joined the beta and followed the stepsyou provided:
The beta now allows you to create Date Time in the HubSpot UI, it has nothing to do with the API. So you would go to create a new property and then choose Datetime
As for the API creation, the “fieldType” parameter never had DateTime as an option, it always stays as Date. Only the “type” needs to be DateTime.
From your request I can see you have selected “textarea” as fieldType, that should be “Date”. Also make sure you have delete all the “Options” and leave blank the fields “reference object type” and “calculation formula”.
Thanks @Humashankar
We are trying to create a property for Contacts, so it has nothing to do with custom objects.
Also, the type can be “datetime” or “date”, but the fieldType can only be “date”.
If you go to this link Accounts Dashboard | HubSpot under Endpoints > Create Property (Core) you can see the values for both Type and Field Type. They are dropdown values.
Again I have done this a few times in the past but something might have changed.
Okay I solved my issue, not sure if it will help you @ADitlevsen@CMyhra@HSchaefer9
All I did was leave blank the fields “reference object type” and “calculation formula” and it worked.
I did use the new Beta docs, not that it matters.
cc @Humashankar