<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M74D8PB" height="0" width="0" style="display:none;visibility:hidden">
Loading
Skip to NavigationSkip to Main Content
0D50Z00008G7VUOSA3Okta Classic EngineIntegrationsAnswered2018-09-05T01:28:04.000Z2015-12-29T21:49:11.000Z2015-12-29T21:49:11.000Z
Using the Events API, is there a way to return the most recent event(s) first?
Using the Events API, is there a way to return the most recent event(s) first?  I need to retrieve the last sign on event for a user for a specific app.  I am able to filter the events using the application ID, query for just a specific user, and limit the results to just 1 but the results are always the oldest events and I need the newest.  The API doesn't show any way of changing the sort order.

  • Louis,

     

    The Events API doesn't have a method that returns the most recent event first. However, the Events model contains a "Published" attribute, which is a timestamp of the event, so the date data is there (ISO 8601 format). You can then write code to sort and/or extract the most recent event.

     

    Cheers,

    Aaron

    Expand Post
  • Louis Winter (Customer)

    Aaron,

     

    Thanks for the update.  I don't think that will work for what I am wanting to do.  I have a status page for a custom application and I wanted to have the date/time each user last logged into the app.  This date/time could be recent, or never if they have been assigned to it but haven't logged in yet.  I really don't want to pull that much data back for every assigned user every time the status page is refreshed.  We'll just go without the last login date/time for now.

     

    Louis
    Expand Post
This question is closed.
Loading
Using the Events API, is there a way to return the most recent event(s) first?