I'm using the "update users API" to change the expiration date for a batch of users.
I am getting a response when I send the post, and it is actually changing the users. But instead of changing to the date I have set in the request, it's changing to "null/never." I've looked at the documentation surrounding the date format (although it's somewhat limited) and I even tried setting one user to the date I wanted, then copying the value from a "get user" response and pasting it into my body, but the same thing keeps happening.
I'm sure I'm missing something obvious, anyone have any ideas?
Here is my post body:
{
"action": "createOrUpdate",
"input": [
{
"expiresAt": "2023-12-31T06:00:00.000t+0000"
}
]
}
Solved! Go to Solution.
Sorry, I don't understand how to resolve that code into an actual date. I spent like two hours trying to figure it out yesterday.
2023-09-01T12:34:56Z
Any datetime library can output this format. It’s the world standard!
That was the date I tried using first! I even tried more than one date converter to generate it and none of them actually work. I feel like I'm losing my mind. I copied from your post to try again and it still doesn't work. I'm so confused.
My post body:
{
"action": "createOrUpdate",
"input": [
{
"expiresAt": "2023-12-31T06:00:00Z"
}
]
}
keeps returning the response:
"expiresAt": null,
Is expiresAt a date time field? Also, why don't you have any meaningful lookup field (like email, person id, etc.) in your POST body? Granted it's not mandatory and technically your Sync lead POST API endpoint should be successful as-is, but it'd just create a new person record with no email address every time you make an API call. Lastly to be sure, you're the Sync lead POST API endpoint only, right?
POST rest/v1/leads.json
No, I am using Update User Attribute. I'm updating system users, not person records, which is why I don't have the ID - it's directly in the URL. It is a datetime according to the documentation:
expiresAt (string) - Date and time when user login expires. Example: yyyy-MM-dd'T'HH:mm:ss.SSS't'Z
@anne_sample_f5 , what language are you coding in? Can you share the relevant code that is producing the payload?
Then we might be able to determine why the datetime info you are generating isn't valid.
Regards
Jo
@anne_sample_f5, that makes sense! Thank you for getting back. Hope you were able to update the users and the expiresAt datetime format worked for you. If not, feel free to let us know and we'd be more than happy to help. 🙂
Here's the correct ISO 8601 format for the datetime you've in your question:
2023-12-31T06:00:00Z
Just for your reference, Z refers to the 0 time zone (UTC). You could optionally add the offset if your datetime is in other timezones than the UTC (e.g., 2023-12-31T06:00:00+05:30). The + or - values indicate how far ahead or behind a time zone is from the UTC zone.
Edit- Sandy already posted a reply for this a few seconds before me! People are so responsive on the community threads. 🙌