I'm using Postman to query an API for a list of users in a group. The JSON response includes a field called "created_at": "2022-05-16T18:07:09Z".
{
"user": [
{
"id": 12345,
"first_name": "Sample",
"last_name": "Person",
"email": "users@emailaddress.com",
"created_at": "2022-05-16T18:07:09Z",
"locale": "en"
}
]
}
I'm trying to have a script first check the users "created_at" date and anyone created over 30 days ago then run the next part of my script which deletes the user from the group.
I'm just having trouble grabbing the created date value so I can check if the user has been in the system for 30 days.
pm.test("Body matches string", function () {
pm.expect(pm.response.text()).to.include("created_at")
});
When I run this test I can find the field in the JSON response.