# Impossibile aggiornare il corpo di un argomento tramite API

**URL:** <https://meta.discourse.org/t/cant-update-a-topics-body-by-api/264640>\
**Category:** Development\
**Tags:** rest-api\
**Created:** [11 Maggio 2023, 12:05pm UTC](https://meta.discourse.org/t/cant-update-a-topics-body-by-api/264640 "2023-05-11T12:05:50Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Dotila\_Li](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dotila_li/32/303426_2.png) [@Dotila\_Li](https://meta.discourse.org/u/Dotila_Li)\
**Post date:** [11 Maggio 2023, 4:11pm UTC](https://meta.discourse.org/t/cant-update-a-topics-body-by-api/264640/4 "2023-05-11T16:11:39Z")

</div>

Wow, hai ragione, funziona 💖

E ho capito come recuperare l’ID del primo post in un argomento usando l’API di Discourse:

```js
async function getFirstPostIdFromOnetopic(topic_id) {
  const Discourse_API_Key = "Discourse_API_Key";
  const url = `https://discourse.mysite.com/t/${topic_id}/posts.json`;

  const response = await fetch(url, {
    method: 'GET',
    headers: {
      "Api-Key": Discourse_API_Key,
      "Api-Username": "system",
      "Content-Type": "application/json",
    }
  });
  const data = await response.json();
  const firstPostId = data.post_stream.posts[0].id;
  
  return firstPostId;
}

```

Grazie e @Lilly 😇

---

_[View the full topic](https://meta.discourse.org/t/cant-update-a-topics-body-by-api/264640)._
