kennym
(Kenny Meyer)
April 19, 2017, 2:30am
1
I’m trying to update a topic body via the API, but I’m not sure how to do it.
I tried to use POST /posts/
and providing it with the topic_id
which only creates a new post for a topic.
I also tried PUT /posts/:id
but providing it with the topic id doesn’t update the topic. I actually get a 403.
PUT /t/:slug/:id
doesn’t seem to be what I’m looking for.
Any advice here, please?
Falco
(Falco)
April 19, 2017, 2:36am
2
The official docs say it’s a PUT
for /posts/:id
with post[raw]
in FormData:
1 Like
kennym
(Kenny Meyer)
April 19, 2017, 2:41am
4
Where :id
is equal to the topic ID in this case?
Falco
(Falco)
April 19, 2017, 2:42am
5
No, it’s the post id.
On Discourse land, a topic it’s just a bunch of posts. A topic has no body, the first post of the topic is the body.
5 Likes
kennym
(Kenny Meyer)
April 19, 2017, 2:43am
7
Falco
(Falco)
April 19, 2017, 4:09am
9
It really depends on how you are managing stuff.
If it’s a sync, you can save the post id of the topic when you create it, so it’s easy when you need to update it later (if that’s a common operation).
3 Likes