Salesforce REST API Recently Viewed Items

In this blog, I am going to explain how to use the salesforce rest API recently viewed the resource. You can able to access the recently viewed data by using even SOQL querying on the RecentlyViewed object or by Using REST API or by using LastViewedDate field with SOQL where clause.A record is considered viewed when the user sees the details associated with it, but not when the user sees it in a list with other records.Use this query in your code to retrieve a list of all the records that were recently viewed.

Salesforce stores information about record views in the interface and uses it to generate a list of recently viewed and referenced records, such as in the sidebar and for the auto-complete options in search.

You can get the Recently Viewed Records by using /services/data/v41.0/recent rest resources.

 Below is the apex class

Here the below Lightning Component.

Component Controller

Component helper