Get a List of Emails Sorted by Last Login Date

Problem statement

This article describes how to get a list of emails sorted by last login date.

Solution

There is no in-house tool to generate the user export based on the last login date. However, you can use the call tovthe POST /api/v2/jobs/users-exports endpoint to include the last_login attribute of the user. Here is a sample body script:

{
    "connection_id": "con_xxx",
    "format": "csv",
    "limit": 5,
    "fields": [
        {
            "name": "email",
            "export_as":"email"
        },
        {
            "name":"last_login",
            "export_as":"last_login"
        }
    ]
}

The call will create a job, and the job_id can be passed to the GET /api/v2/jobs/{id} endpoint. The response will include a link to the export file where the last_login column can be sorted.