Discourse APIのドキュメントにGETリクエストの「リクエストボディ」という記載があります

GETメソッドは常にクエリ文字列を持ち、POSTデータは含みません(そのため、413 Payload Too Largeエラーが発生するのです。GETはデータを受け取らないためです)。サーバーからデータを読み取る際、変更を加えない場合は、POSTではなくGET(ほぼ常に)を使用します。したがって、data= の代わりに params= を使用する必要があります。

この特定のAPI呼び出しに関するドキュメントの記述が不適切だと考えています(「リクエストボディスキーマ」という表記は実際にはPOSTの data を示唆しているため)、この件を Contribute > Bug に移動します。したがって、私に支払いをする必要はありません。

import requests
import json

def get_post_from_topic(topic_id, post_id):
    endpoint = f"https://forum.example.com/t/{topic_id}/posts.json"
    api_username = 'system'
    api_key = 'REDACTED'
    headers = {
        "Content-Type": "application/json",
        "Api-Key": api_key,
        "Api-Username": api_username,
    }
    params = {
      "post_ids[]": post_id
    }
    response = requests.get(endpoint, headers=headers, params = params) 
    if response.status_code == 200:
        return response

response = get_post_from_topic(6,8)
print(response.json())

{"post_stream": {"posts": [{"id": 8, "name": "system", "username": "system", "avatar_template": "/images/discourse-logo-sketch-small.png", "created_at": "2022-06-26T04:44:23.637Z", "cooked": "<p><a name=\"collect\"></a></p>\n<h2>\n<a name=\"what-information-do-we-collectcollect-1\" class=\"anchor\" href=\"#what-information-do-we-collectcollect-1\"></a><a href=\"#collect\">収集する情報...