A user (fbpbdmin) encountered an API error when trying to post a long news list (~25K–30K characters) via Discourse’s REST API, receiving validation errors like ‘Body is too short’ and ‘Body seems unclear’ — despite the content being valid and postable manually. They confirmed the site’s max post length was increased and tried disabling validations with skip_validations: True, which suppressed errors but resulted in empty posts. Others (simon, Canapin, Arkshine) tested the same content and code successfully, suggesting the issue lay in how the content was loaded. The user was reading from a file using open(sys.argv[1]) without specifying encoding. After Arkshine suggested adding encoding="utf8", the user confirmed the problem was in file loading — not the API or content itself — and resolved it, calling it a ‘false alarm’ fbpbdmin.
tried to post a topic with the API, it failed with this error msg: {‘action’: ‘create_post’, ‘errors’: [‘Body is too short (minimum is 1 character)’, ‘Body seems unclear, is it a complete sentence?’]}
the message to post is around 25K, a list of news
can post it manually without error.
but when post it with API, it fails
the default post size is 35K(?), already increase it (in settings) to allow this longer message.
if post a short sentence with the code below, it works fine.
changed body min entropy to 0, it did not help either.
searched the forum, not found a solution,
any idea/suggestions, thanks…
here is the python code
import requests
# Authentication headers
headers = {
"Api-Key": '***',
"Api-Username": 'newsbot',
}
lines = "some news, around 25K"
# Topic data
topic_data = {
"title":"latest news",
"raw": lines,
"category": 28,
}
# Send a POST request to create the topic
response = requests.post('https://www.mydomain.com/posts.json', json=topic_data, headers=headers)
# Check if the request was successful
if response.status_code == 200:
print("Topic created successfully!")
topic_id = response.json().get("id")
print(f"Topic ID: {topic_id}")
else:
print(response.json())
print(f"Failed to create the topic. Status code: {response.status_code}")
btw, the content to post is a list of news like this
[grid]


[/grid]
<details><summary><b>news title</b></summary>
news conentnews conentnews conentnews conentnews
conent news conentnews conentnews conentnews conentnews
conentnews conentnews conentnews conentnews conentnews
conentnews conentnews conentnews conentnews conent
about this long for one news
[The New source 2023-10-16T21:16:45Z](https://www.newssource.com/live/anews)
Try adding "skip_validations": true to the topic_data. (There are cases where true needs to be enclosed in quotation marks, but I don’t think that’s the case with Python.)
The skip_validations parameter will get Discourse to skip performing the validations against site settings like min topic title length and body min entropy.