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]
![](https://static01.nyt.com/images/2023/10/16/multimedia/animage.jpg)
![](https://content.api.news/v3/images/bin/image.jpg)
[/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.