500 oder 400 beim Aktualisieren des Posteninhalts über die API

Ich versuche, den Inhalt eines Beitrags über die API zu aktualisieren. Die Dokumentation unter Discourse API Docs besagt, dass ich PUT /posts/:id.json mit post[raw] im Body senden soll.

Dabei erhalte ich jedoch einen 400-Fehler mit der folgenden Meldung:

errors: [ 'param is missing or the value is empty: post' ]

Der Fehler beklagt einen Parameter namens post, aber wenn ich post[raw] in meiner HTTP-Anfrage durch post ersetze, erhalte ich eine 500-Internal-Server-Error-Antwort.

Der Beitragstext lautete einfach „Edited comment", sodass ich nicht glaube, dass das Problem mit dem Inhalt zusammenhängt.

Habe ich etwas übersehen? Sind die API-Dok veraltet?

Ich betreibe eine Cloud-Instanz unter https://forums.balena.io. Mir ist nicht sicher, welche Discourse-Version verwendet wird.

I just realised I was passing a topic id instead of a post id to the API, but the problem still persists. I’m trying to update post 34816, assuming you have access to the cloud instance:

PUT https://forums.balena.io/posts/34816.json

With body:

{
    "post": "Edited comment"
}

And that still results in 500.

Why is my post being flagged as spam? Is this not the right place to submit bugs?

Turns out it works fine if I pass raw instead of post in the request body. The docs could probably be clearer about that :slight_smile:

4 „Gefällt mir“

Glad you got it figured out! I’ve got a bunch of topics that are me taking to myself.

Mostly these are the docs, and they are continually updated: How to reverse engineer the Discourse API :wink:

I generally forget that there are any docs besides just seeing how it works in the browser development tools.

5 „Gefällt mir“