Back to CloudGen Access CLI Client Usage Examples
1. Find the UserID:
MY_USER_ID=$(access-cli users list -q stran@thisdomain.com -o json | jq -r '.[0].id')
2. Find the resource id for the app name:
MY_RESOURCE_ID=$(access-cli resources list -q "My Example App" -o json | jq -r '.[0].id')
echo $MY_RESOURCE_ID
3. Retrieve the last access time for this UserID for this app:
access-cli records list --sort created_desc --filter-user-id $MY_USER_ID --filter-event-name accessProxyAdmittance -o json | jq '[.[] | select (.params.resource.id == $my_resource_id)][0]|{User: .user.name, Resource: .params.resource.name, LastAccess: .date}' --arg my_resource_id "$MY_RESOURCE_ID"
Example output:
{
"User": “Susan Tran”,
"Resource": "My Example App",
"LastAccess": "2023-09-12T15:50:13.000Z"
}