# How can I allow users to like posts using RESTapi

**URL:** <https://meta.discourse.org/t/how-can-i-allow-users-to-like-posts-using-restapi/339773>\
**Category:** Product Support\
**Tags:** rest-api\
**Created:** [December 2, 2024, 10:08am UTC](https://meta.discourse.org/t/how-can-i-allow-users-to-like-posts-using-restapi/339773 "2024-12-02T10:08:02Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![Maduka\_Dilshan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/maduka_dilshan/32/469573_2.png) [@Maduka\_Dilshan](https://meta.discourse.org/u/Maduka_Dilshan)\
**Post date:** [December 2, 2024, 10:46am UTC](https://meta.discourse.org/t/how-can-i-allow-users-to-like-posts-using-restapi/339773/6 "2024-12-02T10:46:18Z")

</div>

Hi @RGJ

`contentId` is the post id and yes it is the correct post id.

With the following code, it logs,

```plaintext
      this.client.interceptors.request.use((config) => {
        Logger.log(`Request to ${config.url}`);
        Logger.log(`Headers: ${JSON.stringify(config.headers, null, 2)}`);
        Logger.log(`Body: ${JSON.stringify(config.data, null, 2)}`);
        return config;
      })

```

Log,

```plaintext
[Nest] 97134 - 12/02/2024, 4:10:29 PM LOG Request to post_actions.json
[Nest] 97134 - 12/02/2024, 4:10:29 PM LOG Headers: {
  "Accept": "application/json, text/plain, */*",
  "Api-Username": "m...91",
  "Api-Key": "66dc....18b56fbc17bcf"
}
[Nest] 97134 - 12/02/2024, 4:10:29 PM LOG Body: {
  "id": 84,
  "post_action_type_id": 2,
  "flag_topic": false
}

```

---

_[View the full topic](https://meta.discourse.org/t/how-can-i-allow-users-to-like-posts-using-restapi/339773)._
