What is the format you’re trying to pass in? The form on a website can probably take in a ‘pretty’ date and format it automatically. But if you’re trying to pass in a ‘pretty’ date in through the API, it will likely interpret it as a list or text. It has to be in one of the supported formats:
I’ve tried every one of those formats with no success.
Here is the current payload and what I get back.
{
"data": {
"type": "profile",
"id": "XXXXXXXXX",
"attributes": {
},
"properties": {
"LapsedDate": "2024-10-04T00:00:00Z"
},
"meta": {
"patch_properties": {
"append": {
"LapsedDate": "2024-10-04T00:00:00Z"
}
}
}
}
}
"properties": {
"MailChimp Rating": 2,
"LapsedDate": :
"2024-10-04T00:00:00Z"
]
}
Another dumb question, have you verified in the profile page or segment builder that it’s *not* being treated as a date after sending it in via API?
Yes I have confirmed that. If I put the date in manually it segments correctly. If I put the date in via API it is treated as text for the segmenting.
Manually it looks like 2024-10-04T00:00:00Z
API it looks like e“2024-10-04T00:00:00Z”]
If I take out the brackets and quotes manually from the api entered data it is treated like a date.
I’m getting the same problem with ANY custom properties I try to add via API - example:
https://developers.klaviyo.com/en/reference/create_or_update_profile
$payload = =
'data' => ;
'type' => 'profile',
'attributes' => $attributes,
'meta' => ;
'patch_properties' => ;
'append' => ;
'GN_custom' => 'value goes here',
],
],
],
],
];
$response = $this->client->Profiles->createOrUpdateProfile($payload);
I would expect my custom property `GN_custom` to have a value of "value goes here" but instead it is wrapped in an array like this s"value goes here"].
At first I thought it was a problem with their PHP SDK that we’re using, but after debugging that it appears to be just the way the API endpoint handles custom properties. It’s broken.