Which validations can be bypassed and how when using the API to create topics/posts

AI-generated summary

When using the API to create topics/posts, certain validations can be bypassed. Isambard is trying to bypass validations such as “Entropy too low”, “Topic too short”, and “Body too similar”, but is unsure what other checks might be caught.

According to pfaffman, a skip_validations parameter can be passed in Ruby, but it is unclear if this is possible with the API. However, Arkshine confirms that this should work, as WP-Discourse uses it.

Isambard reports a potential bug with skip_validations, where it works for creating a topic but not for replying to it. However, simon disagrees, suggesting that skip_validations only ignores site settings constraints like minimum post length and entropy, and does not allow users to create topics in categories they don’t have permission to post in.

simon also notes that skip_validations is used to ignore posting rate limits.

Which validations can you bypass and how? I’m trying to use API to post and am hitting things like:

  • Entropy too low
  • Topic too short
  • Body too similar

The problem is, it is hard to know what other checks might be caught and so I just stop when I hit one, abort and run again.

If you’re importing more than a few posts from an existing database then you should use a migration script.

There’s a skip_validations parameter you can pass in Ruby, but I don’t know if you can pass it with the API.

But also, do you really want to create a bunch of short posts that have very few different characters and are just like other posts? There are site settings for those that you can change if you search site settings for those words (entropy, minimum post length, min title similar length or allow duplicate titles)

Yes, that should work :+1: (WP-Discourse uses it, for example)

I think there is a bug in the skip validations.

When I use skip validations to create a Topic, this works and it is possible for user to create a topic in a category even if normally he would have no rights to do so.

However, when trying to reply to that same topic, the validation check is not skipped and this post create fails.

Can you elaborate on what post validations you are referring to exactly? What errors do you get?

Are you sure about that? My understanding is that skip_validations does what it says it does in the options section that’s at the bottom of post_creator.rb:

It’s primarily used to ignore the constraints that are added through site settings like:

  • min post length
  • min body entropy
  • min topic title length
    …

I think it’s also used to ignore posting rate limits.

I didn’t think it allowed users to create topics in categories that they don’t have permission to post in.