La documentazione di Discourse API menziona un "request body" per una richiesta GET

GET ha sempre una stringa di query e mai dati post (ecco perché ricevi 413 payload troppo grande, non si aspetta nulla). Quando interroghi dati da un server senza apportare modifiche, userai (quasi) sempre GET e non POST. Quindi dovresti usare params= invece di data=.

Penso che la documentazione per questa specifica chiamata API sia formulata male (" Request Body schema " indica in realtà POST data) quindi sto spostando questo in Bug e non devi pagarmi nulla.

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\">What information do we collect...\n```
5 Mi Piace