You can see my other posts. They were regarding:
- Rate limit issues
- Validation issues
- Validation bypass not working consistently for threads vs topics
In the end, I figure it would be easier to go directly to the database.
Instead of hours of frustration trying to deal with the vagaries of the API, in a few minutes I managed to get something working and hopefully more performant:
For those wanting to do the same, notes from my exploration so far:
First enter the container:
sudo ./launcher enter app
Then connect to the database:
sudo -u postgres psql discourse
To insert a topic:
insert into topics (title, user_id, archetype, fancy_title, category_id, created_at, updated_at, last_post_user_id, bumped_at) values ('psql test', 1, 'regular', 'psql test',8, NOW(), NOW(), 1, NOW());
Get the new id, in my case 886.
Then insert posts:
insert into posts (user_id, topic_id, post_number, raw, cooked, created_at, updated_at, last_version_at) values (1,886,1,'this is the raw text','this is the cooked test',NOW(),NOW(),NOW());
Then update posts_count (if not already done at topic insertion). Note it seems that the topic body needs an initial post. Below changes number of posts of the topic to be 1:
update topics set posts_count=2 where id=886;