In a Dev category discussion titled “Can’t update a topic’s body by API” with tag rest-api, Dotila_Li reported that updating a topic via the Discourse API only changed the title, not the body. Lilly suggested the issue might stem from confusing topic_id with post_id, since the topic’s content resides in its first post. Canapin confirmed this, explaining that topics and posts are separate entities: updating the title requires a PUT to the topic, while updating the body requires a separate PUT to the first post, whose ID can be found in the HTML via the data-post-id attribute. Dotila_Li confirmed the solution worked and shared a JavaScript function to programmatically retrieve the first post’s ID using the /t/{topic_id}/posts.json endpoint, successfully enabling body updates. The thread highlights a common API misunderstanding and provides a practical fix for updating both topic title and body via separate requests.
just a guess from looking at the code, but perhaps it may be because you are using topic_id instead of post_id? because first post is the topic in Discourse, more or less?