Change ownership through the API?

AI-generated summary

Users are discussing how to change post ownership through the API in the discussion titled “Change ownership through the API?”. nottrobin is trying to achieve this, but their attempts using PUT to /posts/{id}.json with post[username] and post[user_id] have been unsuccessful. pfaffman suggests reverse-engineering the Discourse API, but nottrobin hasn’t had time to try this yet. Alternatively, vinothkannans proposes making a POST request to /t/[TOPIC_ID]/change-owner.json with post_ids[] and username form data to change ownership.

I’m trying to change the ownership of posts through the API, but can’t work out how to do it.

I tried using PUT to /posts/{id}.json with setting post[username] and post[user_id], but neither of those seemed to work.

Anyone know how to do this?

Did you start with Reverse engineer the Discourse API

No I’ve not done that yet. I know how to do it, but I don’t have time just this second. I’ll post here if I get around to it and discover the answer =)

Do a POST request to the URL /t/[TOPIC_ID]/change-owner.json with the form data post_ids[] and username.