# Get last ❤ via API

**URL:** https://meta.discourse.org/t/get-last-heart-via-api/69163
**Category:** Development
**Created:** [August 31, 2017, 6:08pm UTC](https://meta.discourse.org/t/get-last-heart-via-api/69163 "2017-08-31T18:08:36Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![juliano](https://avatars.discourse-cdn.com/v4/letter/j/7c8e57/32.png) [@juliano](https://meta.discourse.org/u/juliano)
#### Post date: [August 31, 2017, 6:08pm UTC](https://meta.discourse.org/t/get-last-heart-via-api/69163/1 "2017-08-31T18:08:36Z")

</div>

Hello,

I want to use the Discourse API to get the last like or ❤, that was given by any user on any topic for a specific Discourse instance. Unfortunately I have not found a good way of achieving this. Trying to [crawl the latest topics](http://docs.discourse.org/#tag/Topics%2Fpaths%2F~1latest.json%2Fget) does not seem to be a good idea.

Another thing I tried was using the Discourse webhooks, but unfortunately liking something does not trigger any event, so it seems the API is the only option.

Can somebody tell me how to achieve this? Is this funcionality already built into the API?

Thanks

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [September 1, 2017, 1:16am UTC](https://meta.discourse.org/t/get-last-heart-via-api/69163/2 "2017-09-01T01:16:54Z")

</div>

There might be a better way to do it, but if you’re able to find what you’re looking for with the [Discourse Data Explorer](https://meta.discourse.org/t/data-explorer-plugin/32566) you could either make an API call to the data\_explorer\_plugin, or write a plugin that creates an API endpoint that returns the results of a similar query.

---

<div class="post-metadata">

### Author: ![SidV](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sidv/32/119460_2.png) [@SidV](https://meta.discourse.org/u/SidV)
#### Post date: [September 4, 2017, 2:37pm UTC](https://meta.discourse.org/t/get-last-heart-via-api/69163/3 "2017-09-04T14:37:39Z")

</div>

Did you think some query Simon?

Maybe something like this?

```sql
SELECT p.topic_id, g.given_date, g.user_id
FROM posts p, given_daily_likes g
WHERE p.user_id = g.user_id 
AND like_count >= 1
ORDER BY g.given_date DESC
LIMIT 10

```
