Update Custom Date Picker in Deals through the API
SOLVE
My company has created a custom property under the deals section of Delivery Date (delivery_date) which is set to Date Picker. When I try to post to "Update a Deal" https://api.hubapi.com/deals/v1/deal/{dealID}?hapikey={apiKey}, I get a (400) bad request.
I am converting my DateTime to Unix Milliseconds.
My JSON string looks like this :
{
"properties": [
{
"name":"delivery_date",
"value":1542085200000
}
]
}
Does something look wrong with this request? Or am I supposed to do something before I am allowed to update this field?
The program I am writing is a quick C# windows form to upload an excel file and read the values to a model, convert to JSON, and update the selected Deals by DealID. I am testing various fields before I move everything to a single request. So far, I can't figure out why this field won't accept the Unix Milliseconds.
Update Custom Date Picker in Deals through the API
SOLVE
The datepicker field wants a Unix timestamp with microseconds, but it must be the exact value of midnight in UTC. It will choke on your localized time zone. Here is how I set the value in PHP:
Update Custom Date Picker in Deals through the API
SOLVE
Hi,
I was struggling on this as well. Thanks for your post.
For those who wanna test that your timestamp is based on midnigth UTC you can check it through this website: https://www.epochconverter.com/ For those using momentjs: ``moment.utc(your_date, 'YYYY-MM-DD').valueOf()`` Make sure to replace 'YYYY-MM-DD' with your date format.